diff --git a/vulkano-shaders/src/descriptor_sets.rs b/vulkano-shaders/src/descriptor_sets.rs index 764ac35ba..62e33b841 100644 --- a/vulkano-shaders/src/descriptor_sets.rs +++ b/vulkano-shaders/src/descriptor_sets.rs @@ -117,6 +117,7 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String { ty: {desc_ty}, array_count: 1, stages: ShaderStages::all(), // TODO: + readonly: false, // TODO: }}", binding = d.binding, desc_ty = d.desc_ty) }) .collect::>(); diff --git a/vulkano/src/descriptor/descriptor.rs b/vulkano/src/descriptor/descriptor.rs index 90c25087f..356535024 100644 --- a/vulkano/src/descriptor/descriptor.rs +++ b/vulkano/src/descriptor/descriptor.rs @@ -266,6 +266,9 @@ pub struct DescriptorDesc { /// Which shader stages are going to access this descriptor. pub stages: ShaderStages, + + /// True if the attachment is only ever read by the shader. False if it is also written. + pub readonly: bool, } impl DescriptorDesc { @@ -276,7 +279,8 @@ impl DescriptorDesc { #[inline] pub fn is_superset_of(&self, other: &DescriptorDesc) -> bool { self.binding == other.binding && self.ty == other.ty && - self.array_count >= other.array_count && self.stages.is_superset_of(&other.stages) + self.array_count >= other.array_count && self.stages.is_superset_of(&other.stages) && + (!self.readonly || other.readonly) } } diff --git a/vulkano/src/descriptor/pipeline_layout/custom_pipeline_macro.rs b/vulkano/src/descriptor/pipeline_layout/custom_pipeline_macro.rs index abf1aa8b6..75cb608e4 100644 --- a/vulkano/src/descriptor/pipeline_layout/custom_pipeline_macro.rs +++ b/vulkano/src/descriptor/pipeline_layout/custom_pipeline_macro.rs @@ -188,6 +188,7 @@ macro_rules! pipeline_layout { ty: <$ty as DescriptorMarker>::descriptor_type(), array_count: 1, // TODO: stages: ShaderStages::all(), // TODO: + readonly: false, // TODO: }); binding += 1;