From 056a4b94743f6bab01fd95822c4ab34dd2c58a76 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 7 Jun 2024 21:33:47 -0700 Subject: Small SPIRV emit cleanup around vector element extract. (#4309) --- source/slang/slang-emit-spirv.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(inst->getIndex())) + auto indexOperand = inst->getIndex(); + if (auto globalValueRef = as(indexOperand)) + indexOperand = globalValueRef->getValue(); + if (auto index = as(indexOperand)) { return emitOpCompositeExtract( parent, -- cgit v1.2.3