compile and VVL errors
This commit is contained in:
parent
2446c75d87
commit
8db2d754f8
|
|
@ -446,10 +446,10 @@ impl PhysicalDeviceInfo {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct DevicePools {
|
pub(crate) struct DevicePools {
|
||||||
|
pub(crate) pipeline_cache: asdf::DeviceObject<PipelineCache, Arc<DeviceInner>>,
|
||||||
pub(crate) fences: Arc<Pool<vk::Fence>>,
|
pub(crate) fences: Arc<Pool<vk::Fence>>,
|
||||||
pub(crate) binary_semaphores: Pool<BinarySemaphore>,
|
pub(crate) binary_semaphores: Pool<BinarySemaphore>,
|
||||||
pub(crate) timeline_semaphores: Pool<TimelineSemaphore>,
|
pub(crate) timeline_semaphores: Pool<TimelineSemaphore>,
|
||||||
pub(crate) pipeline_cache: asdf::DeviceObject<PipelineCache, Arc<DeviceInner>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsRef<DevicePools> for DevicePools {
|
impl AsRef<DevicePools> for DevicePools {
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,7 @@ impl PhysicalDeviceFeatures {
|
||||||
mut create_info: vk::DeviceCreateInfo<'a>,
|
mut create_info: vk::DeviceCreateInfo<'a>,
|
||||||
) -> vk::DeviceCreateInfo<'a> {
|
) -> vk::DeviceCreateInfo<'a> {
|
||||||
create_info = create_info
|
create_info = create_info
|
||||||
|
.enabled_features(&self.core)
|
||||||
.push_next(&mut self.core11)
|
.push_next(&mut self.core11)
|
||||||
.push_next(&mut self.core12)
|
.push_next(&mut self.core12)
|
||||||
.push_next(&mut self.core13);
|
.push_next(&mut self.core13);
|
||||||
|
|
@ -923,7 +924,7 @@ impl EguiState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Renderer2 {
|
pub struct Renderer2 {
|
||||||
device: Device,
|
pub device: Device,
|
||||||
pub samplers: SamplerCache,
|
pub samplers: SamplerCache,
|
||||||
pub texture_manager: texture::TextureManager,
|
pub texture_manager: texture::TextureManager,
|
||||||
|
|
||||||
|
|
@ -943,6 +944,10 @@ impl Renderer2 {
|
||||||
&instance,
|
&instance,
|
||||||
&[],
|
&[],
|
||||||
PhysicalDeviceFeatures {
|
PhysicalDeviceFeatures {
|
||||||
|
core: vk::PhysicalDeviceFeatures {
|
||||||
|
multi_draw_indirect: vk::TRUE,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
core11: vk::PhysicalDeviceVulkan11Features {
|
core11: vk::PhysicalDeviceVulkan11Features {
|
||||||
shader_draw_parameters: vk::TRUE,
|
shader_draw_parameters: vk::TRUE,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
|
|
@ -714,7 +714,13 @@ pub(crate) mod pipeline_cache {
|
||||||
|
|
||||||
impl crate::device::asdf::traits::ExternallyManagedObject<Arc<DeviceInner>> for PipelineCache {
|
impl crate::device::asdf::traits::ExternallyManagedObject<Arc<DeviceInner>> for PipelineCache {
|
||||||
unsafe fn destroy(self, owner: &Arc<DeviceInner>) {
|
unsafe fn destroy(self, owner: &Arc<DeviceInner>) {
|
||||||
|
tracing::info!("destroying pipeline cache with key {:x}", self.key);
|
||||||
if let Ok(data) = self.export(&owner.raw) {
|
if let Ok(data) = self.export(&owner.raw) {
|
||||||
|
tracing::info!(
|
||||||
|
"exported pipeline cache with key {:x} and size {} bytes",
|
||||||
|
self.key,
|
||||||
|
data.len()
|
||||||
|
);
|
||||||
_ = Self::write_to_disk(self.key, &data).inspect_err(|err| {
|
_ = Self::write_to_disk(self.key, &data).inspect_err(|err| {
|
||||||
tracing::error!("failed to write pipeline cache to disk: {err}");
|
tracing::error!("failed to write pipeline cache to disk: {err}");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -335,9 +335,6 @@ pub struct Swapchain {
|
||||||
acquire_semaphores: Vec<vk::Semaphore>,
|
acquire_semaphores: Vec<vk::Semaphore>,
|
||||||
release_semaphores: Vec<vk::Semaphore>,
|
release_semaphores: Vec<vk::Semaphore>,
|
||||||
|
|
||||||
// one fence per in-flight frame, to synchronize image acquisition
|
|
||||||
fences: Vec<vk::Fence>,
|
|
||||||
|
|
||||||
current_frame: AtomicU32,
|
current_frame: AtomicU32,
|
||||||
|
|
||||||
// Some of the swapchain operations require external synchronisation; this mutex allows `Swapchain` to be `Sync`.
|
// Some of the swapchain operations require external synchronisation; this mutex allows `Swapchain` to be `Sync`.
|
||||||
|
|
@ -354,11 +351,7 @@ impl Swapchain {
|
||||||
/// This function MUST be called once and only once before the swapchain is dropped.
|
/// This function MUST be called once and only once before the swapchain is dropped.
|
||||||
pub unsafe fn release_resources(&self) {
|
pub unsafe fn release_resources(&self) {
|
||||||
_ = self.swapchain.device().wait_idle();
|
_ = self.swapchain.device().wait_idle();
|
||||||
for fence in &self.fences {
|
|
||||||
unsafe {
|
|
||||||
self.swapchain.device().raw.destroy_fence(*fence, None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for &semaphore in self
|
for &semaphore in self
|
||||||
.acquire_semaphores
|
.acquire_semaphores
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -467,7 +460,7 @@ impl Swapchain {
|
||||||
};
|
};
|
||||||
|
|
||||||
let release_semaphores = {
|
let release_semaphores = {
|
||||||
(0..inflight_frames)
|
(0..images.len())
|
||||||
.map(|i| unsafe {
|
.map(|i| unsafe {
|
||||||
device
|
device
|
||||||
.dev()
|
.dev()
|
||||||
|
|
@ -483,18 +476,6 @@ impl Swapchain {
|
||||||
.collect::<VkResult<Vec<_>>>()?
|
.collect::<VkResult<Vec<_>>>()?
|
||||||
};
|
};
|
||||||
|
|
||||||
let fences = {
|
|
||||||
(0..inflight_frames)
|
|
||||||
.map(|i| unsafe {
|
|
||||||
let fence = device
|
|
||||||
.raw
|
|
||||||
.create_fence(&vk::FenceCreateInfo::default(), None)?;
|
|
||||||
device.debug_name_object(fence, &format!("fence-{:x}_{i}", swapchain.as_raw()));
|
|
||||||
Ok(fence)
|
|
||||||
})
|
|
||||||
.collect::<VkResult<Vec<_>>>()?
|
|
||||||
};
|
|
||||||
|
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
image_count = images.len(),
|
image_count = images.len(),
|
||||||
min_image_count = surface_caps.capabilities.min_image_count,
|
min_image_count = surface_caps.capabilities.min_image_count,
|
||||||
|
|
@ -518,7 +499,6 @@ impl Swapchain {
|
||||||
min_image_count: surface_caps.capabilities.min_image_count,
|
min_image_count: surface_caps.capabilities.min_image_count,
|
||||||
acquire_semaphores,
|
acquire_semaphores,
|
||||||
release_semaphores,
|
release_semaphores,
|
||||||
fences,
|
|
||||||
current_frame: AtomicU32::new(0),
|
current_frame: AtomicU32::new(0),
|
||||||
present_id: AtomicU64::new(1),
|
present_id: AtomicU64::new(1),
|
||||||
})
|
})
|
||||||
|
|
@ -553,7 +533,6 @@ impl Swapchain {
|
||||||
async move {
|
async move {
|
||||||
let fence = Fence::from_pool(&self.swapchain.device().pools.fences, None)?;
|
let fence = Fence::from_pool(&self.swapchain.device().pools.fences, None)?;
|
||||||
let acquire = self.acquire_semaphores[frame];
|
let acquire = self.acquire_semaphores[frame];
|
||||||
let release = self.release_semaphores[frame];
|
|
||||||
|
|
||||||
// spawn on threadpool because it might block.
|
// spawn on threadpool because it might block.
|
||||||
let (idx, suboptimal) = smol::unblock({
|
let (idx, suboptimal) = smol::unblock({
|
||||||
|
|
@ -568,6 +547,8 @@ impl Swapchain {
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
let release = self.release_semaphores[idx as usize];
|
||||||
|
|
||||||
let idx = idx as usize;
|
let idx = idx as usize;
|
||||||
let image = self.images[idx];
|
let image = self.images[idx];
|
||||||
let image = Arc::new(images::Image::from_swapchain_image(image, &self));
|
let image = Arc::new(images::Image::from_swapchain_image(image, &self));
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ impl Fence {
|
||||||
.create_fence(&vk::FenceCreateInfo::default(), None)?
|
.create_fence(&vk::FenceCreateInfo::default(), None)?
|
||||||
};
|
};
|
||||||
Ok(Self::Dedicated {
|
Ok(Self::Dedicated {
|
||||||
fence: DeviceObject::new_debug_named(device.shared, fence, name),
|
fence: DeviceObject::new_debug_named(device.shared.clone(), fence, name),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pub fn from_pool(pool: &Arc<Pool<vk::Fence>>, name: Option<&'static str>) -> Result<Fence> {
|
pub fn from_pool(pool: &Arc<Pool<vk::Fence>>, name: Option<&'static str>) -> Result<Fence> {
|
||||||
|
|
@ -418,7 +418,7 @@ impl Semaphore {
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Self::Dedicated {
|
Ok(Self::Dedicated {
|
||||||
semaphore: DeviceObject::new_debug_named(device.shared, inner, name),
|
semaphore: DeviceObject::new_debug_named(device.shared.clone(), inner, name),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -431,7 +431,7 @@ impl Semaphore {
|
||||||
SemaphoreType::Binary => {
|
SemaphoreType::Binary => {
|
||||||
let semaphore: SemaphoreInner =
|
let semaphore: SemaphoreInner =
|
||||||
device.pools.binary_semaphores.get_debug_named(name)?.into();
|
device.pools.binary_semaphores.get_debug_named(name)?.into();
|
||||||
PoolObject::new(semaphore, device.pools)
|
PoolObject::new(semaphore, device.pools.clone())
|
||||||
}
|
}
|
||||||
SemaphoreType::Timeline(value) => {
|
SemaphoreType::Timeline(value) => {
|
||||||
let semaphore: SemaphoreInner = device
|
let semaphore: SemaphoreInner = device
|
||||||
|
|
@ -447,7 +447,7 @@ impl Semaphore {
|
||||||
device.raw.signal_semaphore(&info)?;
|
device.raw.signal_semaphore(&info)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
PoolObject::new(semaphore, device.pools)
|
PoolObject::new(semaphore, device.pools.clone())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue