WGSL storage address space should always correspond to MSL device add… (#1711)

* WGSL storage address space should always correspond to MSL device address space.

See MSL spec section 4.2.

* Update baselines

* Add error for storage address space if MSL version < 2.

* Update default MSL version to 2.0.
This commit is contained in:
Taylor Holliday authored and GitHub committed 2022-02-03 13:00:04 -05:00
1 parent 9b89c5fa89
commit f63003cd36
23 files changed
+31 -29

No files matched your search

+3 -1
View File
@@ -141,6 +141,8 @@ pub enum Error {
UnsupportedBuiltIn(crate::BuiltIn),
#[error("capability {0:?} is not supported")]
CapabilityNotSupported(crate::valid::Capabilities),
#[error("address space {0:?} is not supported for target MSL version")]
UnsupportedAddressSpace(crate::AddressSpace),
}
#[derive(Clone, Debug, PartialEq, thiserror::Error)]
@@ -185,7 +187,7 @@ pub struct Options {
impl Default for Options {
fn default() -> Self {
Options {
lang_version: (1, 1),
lang_version: (2, 0),
per_stage_map: PerStageMap::default(),
inline_samplers: Vec::new(),
spirv_cross_compatibility: false,
+4 -4
View File
@@ -410,10 +410,7 @@ impl crate::AddressSpace {
match self {
Self::Handle => None,
Self::Uniform | Self::PushConstant => Some("constant"),
Self::Storage { access } if access.contains(crate::StorageAccess::STORE) => {
Some("device")
}
Self::Storage { .. } => Some("constant"),
Self::Storage { .. } => Some("device"),
Self::Private | Self::Function => Some("thread"),
Self::WorkGroup => Some("threadgroup"),
}
@@ -3033,6 +3030,9 @@ impl<W: Write> Writer<W> {
options.resolve_push_constants(ep.stage).ok()
}
crate::AddressSpace::WorkGroup => None,
crate::AddressSpace::Storage { .. } if options.lang_version < (2, 0) => {
return Err(Error::UnsupportedAddressSpace(var.space))
}
_ => options
.resolve_resource_binding(ep.stage, var.binding.as_ref().unwrap())
.ok(),