Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[naga] Implement binding_array function arguments #6523

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

davnotdev
Copy link

@davnotdev davnotdev commented Nov 12, 2024

Connections
Fixes both cases described in #4857.
Also related to #6283.

Description
There are two cases addressed here:

  1. Allowing binding arrays to appear as function arguments by implementing various missing branches that this case triggers.
  2. Fix issue where OpFunctionCall uses the value of an opaque type loaded via OpAccessChain + 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 when OpAccessChain 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

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@davnotdev davnotdev requested a review from a team as a code owner November 12, 2024 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant