diff options
| author | davli-nv <davli@nvidia.com> | 2025-07-24 19:26:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-25 02:26:22 +0000 |
| commit | fa946c659bd5ad577f30cf4565e13f9dcfc6937a (patch) | |
| tree | 05b4bc19bf75692567071d7c07a2d26845e87743 | |
| parent | 1a88488c309eab24b8f931c182353b271f22b44d (diff) | |
Fix SPIRV OpMemberName member indices (#7912)
OpMemberName instructions were all using member index 0 instead of
incrementing indices (0, 1, 2, ...) as required by the SPIR-V spec.
The bug was that the member index increment (id++) was only happening
for physical struct types, but OpMemberName emission occurs for all
struct types when they have name decorations.
This fix ensures member indices are properly incremented for both
physical and non-physical struct types.
Fixes #7909
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: davli-nv <davli-nv@users.noreply.github.com>
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index c9f84a9f6..7f56daf09 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -5738,7 +5738,10 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex } if (!isPhysicalType) + { + id++; continue; + } // Emit explicit struct field layout decorations if the struct is physical. IRIntegerValue offset = 0; |
