summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit-cpp.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-12 10:01:11 -0700
committerGitHub <noreply@github.com>2024-03-12 10:01:11 -0700
commitd8eb701170bf6050718750e6a5e72aa55fb5bd45 (patch)
tree175b225bbabf47d2108ef4c786fea00136cdde1a /source/slang/slang-emit-cpp.cpp
parenta91af961e4c96236e962be9ff51835c07a45cd14 (diff)
Support emitting generic target_intrinsic type. (#3745)
Diffstat (limited to 'source/slang/slang-emit-cpp.cpp')
-rw-r--r--source/slang/slang-emit-cpp.cpp23
1 files changed, 23 insertions, 0 deletions
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<IRIntLit>(type);
+ out << intLit->getValue();
+ return SLANG_OK;
+ }
default:
{
if (isNominalOp(type->getOp()))