This repository was archived by the owner on Jan 29, 2025. It is now read-only.
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.
This pull request extends #1845 by implementing support for binding arrays for the SPIR-V frontend 🙂
In general, the changes here boil down to adjusting
parse_type_array()
so that it emitscrate::TypeInner::BindingArray
for texture-based arrays and sampler-based array -- as you'll see in the comments, the approach implemented here is kinda hacky, because - contrary to the wgls' frontend - when parsingOpTypeArray
/OpTypeRuntimeArray
we can't yet know whether it's going to be used through a binding or not.I think that ideally instead of taking a guess in
parse_type_array()
, we'd adjustparse_global_variable()
to do something like:... but that doesn't work, since it leaves the original type in
module.types
, causingvalidate_type()
to fail later (because it always iterates through all of the types, even if they are not actually used anywhere, as would be the case here).I'm currently writing a raytracer using rust-gpu and I've confirmed that a shader allowed by Naga with this patch actually works (on Linux + Nvidia, I haven't checked it on Windows or Mac).
Related to:
gfx-rs/wgpu#4313.