Make sampled parameter of texel buffers less confusing

This commit is contained in:
Pierre Krieger 2016-07-15 13:26:33 +02:00
parent a26fc00359
commit cf9b4f76b8
2 changed files with 15 additions and 9 deletions

View File

@ -208,9 +208,9 @@ fn descriptor_infos(doc: &parse::Spirv, pointed_ty: u32, force_combined_image_sa
} else if let &enums::Dim::DimBuffer = dim {
// We are a texel buffer.
let desc = format!("DescriptorDescTy::TexelBuffer {{
sampled: {},
storage: {},
format: None, // TODO: specify format if known
}}", sampled);
}}", !sampled);
Some((desc, true))

View File

@ -48,7 +48,13 @@ pub enum DescriptorDescTy {
Sampler, // TODO: the sampler has some restrictions as well
CombinedImageSampler(DescriptorImageDesc), // TODO: the sampler has some restrictions as well
Image(DescriptorImageDesc),
TexelBuffer { sampled: bool, format: Option<Format> },
TexelBuffer {
/// If `true`, this describes a storage texel buffer.
storage: bool,
/// The format of the content, or `None` if the format is unknown. Depending on the
/// context, it may be invalid to have a `None` value here.
format: Option<Format>,
},
InputAttachment { multisampled: bool, array_layers: DescriptorImageDescArray },
Buffer(DescriptorBufferDesc),
}
@ -75,9 +81,9 @@ impl DescriptorDescTy {
(true, true) => DescriptorType::StorageBufferDynamic,
}
},
DescriptorDescTy::TexelBuffer { sampled, .. } => {
if sampled { DescriptorType::UniformTexelBuffer }
else { DescriptorType::StorageTexelBuffer }
DescriptorDescTy::TexelBuffer { storage, .. } => {
if storage { DescriptorType::StorageTexelBuffer }
else { DescriptorType::UniformTexelBuffer }
},
})
}
@ -115,10 +121,10 @@ impl DescriptorDescTy {
}
},
(DescriptorDescTy::TexelBuffer { sampled: me_sampled, format: me_format },
DescriptorDescTy::TexelBuffer { sampled: other_sampled, format: other_format }) =>
(DescriptorDescTy::TexelBuffer { storage: me_storage, format: me_format },
DescriptorDescTy::TexelBuffer { storage: other_storage, format: other_format }) =>
{
if me_sampled != other_sampled {
if me_storage != other_storage {
return false;
}