Mark base variable as accessed for nested access chains - #144
Merged
PENGUINLIONG merged 1 commit intoJul 28, 2026
Merged
Conversation
A load or store through a nested access chain resolved only one level, marking the intermediate access-chain result as accessed instead of the base variable. The base variable was therefore treated as unused and dropped from the reflection output.
Owner
|
Thanks! |
Contributor
Author
|
Thank you for accepting the patch @PENGUINLIONG, this library is quite useful. May I ask if there are plans to cut a new crates.io release that includes this fix? Right now the only way to consume it is by pinning to a git revision, which is a bit awkward in some setups that by default only accept crates.io dependencies. This can be worked around, so I understand if there are no plans for a release yet. |
Owner
|
Glad to hear that! For the release thing. since I haven't been working with SPIR-V for a while, I'd like to review the spec first and see if anything else should be fixed also. It should be quick. ;) |
Owner
|
A new version 1.3.0 has been released with this fix. 😃 |
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.
When inspecting a function's instructions, a load or store through a nested access chain (an access chain based on another access chain) marked an intermediate access-chain result as accessed, rather than the base variable. As a result, a variable reached only through such a chain was considered unused and dropped from the reflection output.
This happens, for example, with an SSBO whose element is a struct that is accessed member-wise (
buffer[i].member), where the compiler emits one access chain to the element and a second into the member.With this PR, the access chain is resolved transitively up to the base variable, which is then marked as accessed.