summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-06-07 21:33:47 -0700
committerGitHub <noreply@github.com>2024-06-07 21:33:47 -0700
commit056a4b94743f6bab01fd95822c4ab34dd2c58a76 (patch)
tree3c02ab68c6a7cf1446c067bc825eccdca9ac2df2
parentf83fe55a8c0859e2de832b71555b42a3630103a3 (diff)
Small SPIRV emit cleanup around vector element extract. (#4309)
-rw-r--r--source/slang/slang-emit-spirv.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index 08f32fa16..769e36861 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -4776,7 +4776,10 @@ struct SPIRVEmitContext
IRBuilder builder(m_irModule);
builder.setInsertBefore(inst);
- if (auto index = as<IRIntLit>(inst->getIndex()))
+ auto indexOperand = inst->getIndex();
+ if (auto globalValueRef = as<IRGlobalValueRef>(indexOperand))
+ indexOperand = globalValueRef->getValue();
+ if (auto index = as<IRIntLit>(indexOperand))
{
return emitOpCompositeExtract(
parent,