Prevent ray queries hoisted out of loops from generating invalid code - #9945
Open
Vecvec wants to merge 7 commits into
Open
Prevent ray queries hoisted out of loops from generating invalid code#9945Vecvec wants to merge 7 commits into
Vecvec wants to merge 7 commits into
Conversation
inner-daemons
self-requested a review
July 27, 2026 20:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Should fix #9890
Description
When a variable is used in a loop, it must be zero initialized to prevent previous states from being used. naga did this, but also emitted zero initializes for ray queries which is invalid. This caused validation errors on all platforms (a disallowed store on msl, an invalid zero-value on spirv, and a crash on hlsl). This instead adds a
Beginray query function which behaves as if the ray query was a new variable (zeroing its tracker) and uses this for ray query variables in loops. This PR also includes validation against stores.Naming is rather bad, so suggestions are welcome.
Testing
adds a snapshot test for the loops and also a wgsl errors test for the store validation
Squash or Rebase?
Squash
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.