From fa946c659bd5ad577f30cf4565e13f9dcfc6937a Mon Sep 17 00:00:00 2001 From: davli-nv Date: Thu, 24 Jul 2025 19:26:22 -0700 Subject: 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 --- source/slang/slang-emit-spirv.cpp | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v1.2.3