From d8eb701170bf6050718750e6a5e72aa55fb5bd45 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 12 Mar 2024 10:01:11 -0700 Subject: Support emitting generic target_intrinsic type. (#3745) --- source/slang/slang-emit-cpp.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source') diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp index 48832f497..2b1f6ad81 100644 --- a/source/slang/slang-emit-cpp.cpp +++ b/source/slang/slang-emit-cpp.cpp @@ -313,6 +313,29 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S out << ">"; return SLANG_OK; } + case kIROp_Specialize: + { + auto inner = getResolvedInstForDecorations(type); + if (auto targetIntrinsic = findBestTargetIntrinsicDecoration(inner, getTargetCaps())) + { + out << targetIntrinsic->getDefinition(); + out << "<"; + for (UInt i = 1; i < type->getOperandCount(); i++) + { + if (i > 1) out << ", "; + auto elementType = (IRType*)type->getOperand(i); + SLANG_RETURN_ON_FAIL(calcTypeName(elementType, target, out)); + } + out << ">"; + return SLANG_OK; + } + } + case kIROp_IntLit: + { + auto intLit = as(type); + out << intLit->getValue(); + return SLANG_OK; + } default: { if (isNominalOp(type->getOp())) -- cgit v1.2.3