summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 49273163e..3bd31d6e9 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -4162,6 +4162,17 @@ IRInst* IRBuilder::emitMakeVectorFromScalar(IRType* type, IRInst* scalarValue)
return emitIntrinsicInst(type, kIROp_MakeVectorFromScalar, 1, &scalarValue);
}
+IRInst* IRBuilder::emitMakeCompositeFromScalar(IRType* type, IRInst* scalarValue)
+{
+ switch (type->getOp())
+ {
+ case kIROp_VectorType: return emitMakeVectorFromScalar(type, scalarValue);
+ case kIROp_MatrixType: return emitMakeMatrixFromScalar(type, scalarValue);
+ case kIROp_ArrayType: return emitMakeArrayFromElement(type, scalarValue);
+ default: SLANG_UNEXPECTED("unhandled composite type"); UNREACHABLE_RETURN(nullptr);
+ }
+}
+
IRInst* IRBuilder::emitMatrixReshape(IRType* type, IRInst* inst)
{
return emitIntrinsicInst(type, kIROp_MatrixReshape, 1, &inst);