summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-10-14 11:19:33 -0700
committerGitHub <noreply@github.com>2025-10-14 18:19:33 +0000
commitb173149f4f48b5331ebd3c3643f9449c7a29d72e (patch)
tree602948b8897dfa3c393fb2e9932cd712e6b61c2d /source/compiler-core
parent5978f934ee9a8a3e710dc743a4af92191639b718 (diff)
Handle SPIR-V aliases (#8704)
Fixes https://github.com/shader-slang/slang/issues/8703
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-spirv-core-grammar.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/compiler-core/slang-spirv-core-grammar.cpp b/source/compiler-core/slang-spirv-core-grammar.cpp
index 8b5e79071..5f8043e65 100644
--- a/source/compiler-core/slang-spirv-core-grammar.cpp
+++ b/source/compiler-core/slang-spirv-core-grammar.cpp
@@ -44,6 +44,7 @@ struct Instruction
UnownedStringSlice class_;
SpvWord opcode;
List<UnownedStringSlice> capabilities;
+ List<UnownedStringSlice> aliases;
List<Operand> operands;
};
SLANG_MAKE_STRUCT_RTTI_INFO(
@@ -52,6 +53,7 @@ SLANG_MAKE_STRUCT_RTTI_INFO(
SLANG_RTTI_FIELD_IMPL(class_, "class", 0),
SLANG_RTTI_FIELD(opcode),
SLANG_OPTIONAL_RTTI_FIELD(capabilities),
+ SLANG_OPTIONAL_RTTI_FIELD(aliases),
SLANG_OPTIONAL_RTTI_FIELD(operands));
struct Enumerant
@@ -223,6 +225,11 @@ RefPtr<SPIRVCoreGrammarInfo> SPIRVCoreGrammarInfo::loadFromJSON(
{
res->opcodes.dict.add(i.opname, SpvOp(i.opcode));
+ for (auto alias : i.aliases)
+ {
+ res->opcodes.dict.add(alias, SpvOp(i.opcode));
+ }
+
const auto class_ = i.class_ == "Type-Declaration" ? OpInfo::TypeDeclaration
: i.class_ == "Constant-Creation" ? OpInfo::ConstantCreation
: i.class_ == "Debug" ? OpInfo::Debug