From 7c2ff54758d26b73074fd14143ecd843ba685e0d Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 4 Nov 2024 17:37:50 -0800 Subject: 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> --- source/slang/slang-ir.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/slang/slang-ir.cpp') 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); -- cgit v1.2.3