[naga] Implement binding_array function arguments #6523
+109
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
Fixes both cases described in #4857.
Also related to #6283.
Description
There are two cases addressed here:
OpFunctionCall
uses the value of an opaque type loaded viaOpAccessChain
+OpLoad
is used as the argument when only the pointer to that opaque type is valid. This is implemented by keeping track of the pointer id of a loaded variable whenOpAccessChain
is called.I'm not two happy with the 2nd fix because it uses an extra map for a relatively obscure edge case. Hopefully, there is a function that does the equivalent.
Testing
To test these changes, I ran the following shaders through naga multiple times (
SPV => spirv-val => WGSL => SPV => spirv-val => WGSL => SPV => spirv-val
).The cases described in the WGPU issue above:
https://shader-playground.timjones.io/8a6382938dcc19b6d86bb569a93f1872
https://shader-playground.timjones.io/e37907fe8b30779a53201ef5ba4e1809
The issue I am running into:
https://shader-playground.timjones.io/656df9d61201d86379fe5c6f6b04d43a
(For this shader, the assumption is that
SPV_EXT_descriptor_indexing
is removed after every translation.)Checklist
cargo fmt
.taplo format
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.