wgpu
wgpu copied to clipboard
Support `@must_use` function attribute in WGSL
We do not currently support the @must_use
function attribute, despite being specified in the current v1 spec. draft. This was introduced in early 2023; see gpuweb/gpuweb
#3862, gpuweb/gpuweb
#3819.
Repro steps
Ideally, a runnable example we can check out.
-
With this
in.wgsl
input file:@must_use fn helper() -> u32 { return 2; } @compute @workgroup_size(1) fn comp_main() { let asdf = helper(); }
…run this on latest
trunk
(ATOW, d239361c1f5d5cfb8cee73382b1e8bc8476e3b29):$ cargo run -p naga-cli --all-features -- in.wgsl
Expected vs observed behavior
Clearly describe what you get, and how it goes across your expectations.
This should compile without error. The asdf
binding is unused, but that should, at most, be a warning. Instead, the current output of repro steps is:
Could not parse WGSL:
error: unknown attribute: 'must_use'
┌─ in.wgsl:1:2
│
1 │ @must_use
│ ^^^^^^^^ unknown attribute
Firefox bug: bug 1878314
This is a higher priority than it might appear, because it prevents some popular WebGPU demos from running.