mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Require dynamically sized arrays to appear in 'storage' memory.
WGSL requires that runtime-sized arrays appear only as the last member of a structure in in the `storage` storage class. It seems to me that Naga should enforce this restriction on its own IR as well.
This commit is contained in:
committed by
Dzmitry Malyshau
parent
813da7a87e
commit
99fbb34bd6
@@ -346,9 +346,11 @@ impl super::Validator {
|
||||
};
|
||||
(access, TypeFlags::empty(), true)
|
||||
}
|
||||
crate::StorageClass::Private | crate::StorageClass::WorkGroup => {
|
||||
(crate::StorageAccess::empty(), TypeFlags::DATA, false)
|
||||
}
|
||||
crate::StorageClass::Private | crate::StorageClass::WorkGroup => (
|
||||
crate::StorageAccess::empty(),
|
||||
TypeFlags::DATA | TypeFlags::SIZED,
|
||||
false,
|
||||
),
|
||||
crate::StorageClass::PushConstant => {
|
||||
if !self.capabilities.contains(Capabilities::PUSH_CONSTANT) {
|
||||
return Err(GlobalVariableError::UnsupportedCapability(
|
||||
@@ -357,7 +359,7 @@ impl super::Validator {
|
||||
}
|
||||
(
|
||||
crate::StorageAccess::LOAD,
|
||||
TypeFlags::DATA | TypeFlags::HOST_SHARED,
|
||||
TypeFlags::DATA | TypeFlags::HOST_SHARED | TypeFlags::SIZED,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -294,8 +294,12 @@ impl super::Validator {
|
||||
|
||||
TypeFlags::SIZED
|
||||
}
|
||||
//Note: this will be detected at the struct level
|
||||
crate::ArraySize::Dynamic => TypeFlags::empty(),
|
||||
crate::ArraySize::Dynamic => {
|
||||
// Non-SIZED types may only appear as the last element of a structure.
|
||||
// This is enforced by checks for SIZED-ness for all compound types,
|
||||
// and a special case for structs.
|
||||
TypeFlags::empty()
|
||||
}
|
||||
};
|
||||
|
||||
let base_mask = TypeFlags::HOST_SHARED | TypeFlags::INTERFACE;
|
||||
|
||||
Reference in New Issue
Block a user