summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-11-04 17:37:50 -0800
committerGitHub <noreply@github.com>2024-11-04 17:37:50 -0800
commit7c2ff54758d26b73074fd14143ecd843ba685e0d (patch)
tree0abe5c4f11de2bdb1e960a3fef441c36d420966e /source/slang/slang-ir.cpp
parent2c8dacfa471903a802a252905ec108420ee25d63 (diff)
Various WGSL fixes. (#5490)
* [WGSL] make sure switch has a default label. * Various WGSL fixes. * Update rhi submodule commit * format code * Remove unnecessary DISABLE_TEST directive on not applicable test. * Matrix comp mul + `select`. * Legalize binary ops for wgsl. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
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);