AFAICT, according to Resource Layout Compatibility, WGSL does not consider write-only storage buffers to be part of the resource interface.
Naga 0.8.5 appears to validate the following fragment of module-scope WGSL:
[[group(2), binding(0)]] var<storage, write> my_struct_global_variable: MyStruct;
Behavior on master-as-of-this-post is similar. Inserting the following module-scope WGSL fragment in tests/in/access.wgsl results in a passing cargo test:
struct Baz {
a: u32,
};
@group(1) @binding(0)
var<storage,write> baz: Baz;
But trying to actually use such a binding through wgpu results in errors like:
thread 'main' panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_compute_pipeline
error matching shader requirements against the pipeline
shader global ResourceBinding { group: 2, binding: 0 } is not available in the layout pipeline layout
storage class Storage { access: LOAD | STORE } doesn't match the shader Storage { access: STORE }
'
Because it's making the reasonable assumption that the shader wanted something readable.
AFAICT, according to Resource Layout Compatibility, WGSL does not consider write-only storage buffers to be part of the resource interface.
Naga 0.8.5 appears to validate the following fragment of module-scope WGSL:
Behavior on
master-as-of-this-post is similar. Inserting the following module-scope WGSL fragment intests/in/access.wgslresults in a passingcargo test:But trying to actually use such a binding through
wgpuresults in errors like:Because it's making the reasonable assumption that the shader wanted something readable.