diff --git a/vulkano/src/command_buffer/mod.rs b/vulkano/src/command_buffer/mod.rs index 8a1800ea1b..19cde0630d 100644 --- a/vulkano/src/command_buffer/mod.rs +++ b/vulkano/src/command_buffer/mod.rs @@ -534,7 +534,7 @@ pub(crate) struct CommandBufferBufferUsage { #[derive(Clone, Debug, PartialEq, Eq)] pub(crate) struct CommandBufferBufferRangeUsage { - pub(crate) first_use: ResourceUseRef, + pub(crate) first_use: Option, pub(crate) mutable: bool, } @@ -546,7 +546,7 @@ pub(crate) struct CommandBufferImageUsage { #[derive(Clone, Debug, PartialEq, Eq)] pub(crate) struct CommandBufferImageRangeUsage { - pub(crate) first_use: ResourceUseRef, + pub(crate) first_use: Option, pub(crate) mutable: bool, pub(crate) expected_layout: ImageLayout, pub(crate) final_layout: ImageLayout, diff --git a/vulkano/src/command_buffer/synced/builder.rs b/vulkano/src/command_buffer/synced/builder.rs index c66439bfb5..eedd91cc70 100644 --- a/vulkano/src/command_buffer/synced/builder.rs +++ b/vulkano/src/command_buffer/synced/builder.rs @@ -26,7 +26,7 @@ use crate::{ }, descriptor_set::{DescriptorSetResources, DescriptorSetWithOffsets}, device::{Device, DeviceOwned}, - image::{sys::Image, ImageAccess, ImageLayout, ImageSubresourceRange}, + image::{sys::Image, ImageAccess, ImageAspects, ImageLayout, ImageSubresourceRange}, pipeline::{ graphics::{ color_blend::LogicOp, @@ -539,6 +539,19 @@ impl SyncCommandBufferBuilder { subresource_range.mip_levels.start += inner.first_mipmap_level; subresource_range.mip_levels.end += inner.first_mipmap_level; + // VUID-VkImageMemoryBarrier2-image-03320 + if !self + .device() + .enabled_features() + .separate_depth_stencil_layouts + && image + .format() + .aspects() + .contains(ImageAspects::DEPTH | ImageAspects::STENCIL) + { + subresource_range.aspects = ImageAspects::DEPTH | ImageAspects::STENCIL; + } + let range_map = self.images2.entry(inner.image.clone()).or_insert_with(|| { [( 0..inner.image.range_size(), @@ -816,7 +829,7 @@ impl SyncCommandBufferBuilder { .into_iter() .filter(|(_range, state)| !state.resource_uses.is_empty()) .map(|(range, state)| { - let first_use = state.resource_uses.into_iter().next().unwrap(); + let first_use = state.resource_uses.into_iter().next(); ( range, CommandBufferBufferRangeUsage { @@ -845,7 +858,7 @@ impl SyncCommandBufferBuilder { state.current_layout = state.final_layout; } - let first_use = state.resource_uses.into_iter().next().unwrap(); + let first_use = state.resource_uses.into_iter().next(); ( range, CommandBufferImageRangeUsage { diff --git a/vulkano/src/sync/future/mod.rs b/vulkano/src/sync/future/mod.rs index c6c6f9b7d1..9e9ddda9b8 100644 --- a/vulkano/src/sync/future/mod.rs +++ b/vulkano/src/sync/future/mod.rs @@ -602,7 +602,7 @@ pub enum FlushError { /// Access to a resource has been denied. ResourceAccessError { error: AccessError, - use_ref: ResourceUseRef, + use_ref: Option, }, /// The command buffer or one of the secondary command buffers it executes was created with the