Add readonly member to DescriptorDesc

This commit is contained in:
Pierre Krieger 2016-04-08 18:24:03 +02:00
parent 3ade419e1d
commit 0aedde53f1
3 changed files with 7 additions and 1 deletions

View File

@ -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::<Vec<_>>();

View File

@ -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)
}
}

View File

@ -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;