compile and VVL errors

This commit is contained in:
janis 2026-04-07 18:48:06 +02:00
parent 2446c75d87
commit 8db2d754f8
5 changed files with 21 additions and 29 deletions

View file

@ -446,10 +446,10 @@ impl PhysicalDeviceInfo {
#[derive(Debug)]
pub(crate) struct DevicePools {
pub(crate) pipeline_cache: asdf::DeviceObject<PipelineCache, Arc<DeviceInner>>,
pub(crate) fences: Arc<Pool<vk::Fence>>,
pub(crate) binary_semaphores: Pool<BinarySemaphore>,
pub(crate) timeline_semaphores: Pool<TimelineSemaphore>,
pub(crate) pipeline_cache: asdf::DeviceObject<PipelineCache, Arc<DeviceInner>>,
}
impl AsRef<DevicePools> for DevicePools {

View file

@ -205,6 +205,7 @@ impl PhysicalDeviceFeatures {
mut create_info: vk::DeviceCreateInfo<'a>,
) -> vk::DeviceCreateInfo<'a> {
create_info = create_info
.enabled_features(&self.core)
.push_next(&mut self.core11)
.push_next(&mut self.core12)
.push_next(&mut self.core13);
@ -923,7 +924,7 @@ impl EguiState {
}
pub struct Renderer2 {
device: Device,
pub device: Device,
pub samplers: SamplerCache,
pub texture_manager: texture::TextureManager,
@ -943,6 +944,10 @@ impl Renderer2 {
&instance,
&[],
PhysicalDeviceFeatures {
core: vk::PhysicalDeviceFeatures {
multi_draw_indirect: vk::TRUE,
..Default::default()
},
core11: vk::PhysicalDeviceVulkan11Features {
shader_draw_parameters: vk::TRUE,
..Default::default()

View file

@ -714,7 +714,13 @@ pub(crate) mod pipeline_cache {
impl crate::device::asdf::traits::ExternallyManagedObject<Arc<DeviceInner>> for PipelineCache {
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) {
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| {
tracing::error!("failed to write pipeline cache to disk: {err}");
});

View file

@ -335,9 +335,6 @@ pub struct Swapchain {
acquire_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,
// 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.
pub unsafe fn release_resources(&self) {
_ = self.swapchain.device().wait_idle();
for fence in &self.fences {
unsafe {
self.swapchain.device().raw.destroy_fence(*fence, None);
}
}
for &semaphore in self
.acquire_semaphores
.iter()
@ -467,7 +460,7 @@ impl Swapchain {
};
let release_semaphores = {
(0..inflight_frames)
(0..images.len())
.map(|i| unsafe {
device
.dev()
@ -483,18 +476,6 @@ impl Swapchain {
.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!(
image_count = images.len(),
min_image_count = surface_caps.capabilities.min_image_count,
@ -518,7 +499,6 @@ impl Swapchain {
min_image_count: surface_caps.capabilities.min_image_count,
acquire_semaphores,
release_semaphores,
fences,
current_frame: AtomicU32::new(0),
present_id: AtomicU64::new(1),
})
@ -553,7 +533,6 @@ impl Swapchain {
async move {
let fence = Fence::from_pool(&self.swapchain.device().pools.fences, None)?;
let acquire = self.acquire_semaphores[frame];
let release = self.release_semaphores[frame];
// spawn on threadpool because it might block.
let (idx, suboptimal) = smol::unblock({
@ -568,6 +547,8 @@ impl Swapchain {
})
.await?;
let release = self.release_semaphores[idx as usize];
let idx = idx as usize;
let image = self.images[idx];
let image = Arc::new(images::Image::from_swapchain_image(image, &self));

View file

@ -204,7 +204,7 @@ impl Fence {
.create_fence(&vk::FenceCreateInfo::default(), None)?
};
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> {
@ -418,7 +418,7 @@ impl Semaphore {
};
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 => {
let semaphore: SemaphoreInner =
device.pools.binary_semaphores.get_debug_named(name)?.into();
PoolObject::new(semaphore, device.pools)
PoolObject::new(semaphore, device.pools.clone())
}
SemaphoreType::Timeline(value) => {
let semaphore: SemaphoreInner = device
@ -447,7 +447,7 @@ impl Semaphore {
device.raw.signal_semaphore(&info)?;
}
PoolObject::new(semaphore, device.pools)
PoolObject::new(semaphore, device.pools.clone())
}
};