summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-metal-legalize.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/slang/slang-ir-metal-legalize.cpp b/source/slang/slang-ir-metal-legalize.cpp
index 589413cbf..116feeab4 100644
--- a/source/slang/slang-ir-metal-legalize.cpp
+++ b/source/slang/slang-ir-metal-legalize.cpp
@@ -32,10 +32,18 @@ void legalizeImageStoreValue(IRBuilder& builder, IRImageStore* imageStore)
}
}
elementType = valueVectorType->getElementType();
- auto vectorValue = as<IRMakeVector>(originalValue);
- for (UInt i = 0; i < vectorValue->getOperandCount(); i++)
+
+ // Extract components using IRElementExtract to handle any vector instruction type
+ if (auto originalElementCount = as<IRIntLit>(valueVectorType->getElementCount()))
{
- components.add(vectorValue->getOperand(i));
+ for (UInt i = 0; i < (UInt)originalElementCount->getValue(); i++)
+ {
+ auto elementExtract = builder.emitElementExtract(
+ elementType,
+ originalValue,
+ builder.getIntValue(builder.getIntType(), i));
+ components.add(elementExtract);
+ }
}
}
else