Skip to content

Mark base variable as accessed for nested access chains - #144

Merged
PENGUINLIONG merged 1 commit into
PENGUINLIONG:masterfrom
CesarATV:fix/nested-access-chain-binding-dropped
Jul 28, 2026
Merged

Mark base variable as accessed for nested access chains#144
PENGUINLIONG merged 1 commit into
PENGUINLIONG:masterfrom
CesarATV:fix/nested-access-chain-binding-dropped

Conversation

@CesarATV

Copy link
Copy Markdown
Contributor

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.

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.
@PENGUINLIONG
PENGUINLIONG merged commit a37875f into PENGUINLIONG:master Jul 28, 2026
1 check passed
@PENGUINLIONG

Copy link
Copy Markdown
Owner

Thanks!

@CesarATV
CesarATV deleted the fix/nested-access-chain-binding-dropped branch July 28, 2026 13:55
@CesarATV

Copy link
Copy Markdown
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.

@PENGUINLIONG

Copy link
Copy Markdown
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. ;)

@PENGUINLIONG

Copy link
Copy Markdown
Owner

A new version 1.3.0 has been released with this fix. 😃

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.

2 participants