summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-09-15 20:37:45 -0700
committerGitHub <noreply@github.com>2022-09-15 20:37:45 -0700
commita5d3bec25d70f23da1e79cd7773981ff34593611 (patch)
tree92c8cb983c57bbee141d4e6f3f91f265e04d6a08 /source/slang/slang-emit-c-like.cpp
parenta6032446c6bf7f64d1e201bf438a4c7605a3dbb4 (diff)
Run simple compute kernel in gfx-smoke test. (#2400)
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 734471fd0..dcd25419e 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -981,9 +981,8 @@ void CLikeSourceEmitter::emitSimpleValueImpl(IRInst* inst)
m_writer->emitUInt64(uint64_t(litInst->value.intVal));
m_writer->emit(")");
#else
- m_writer->emit("uint(");
m_writer->emit(UInt(uint32_t(litInst->value.intVal)));
- m_writer->emit(")");
+ m_writer->emit("U");
#endif
break;
}
@@ -1617,6 +1616,7 @@ void CLikeSourceEmitter::emitComInterfaceCallExpr(IRCall* inst, EmitOpInfo const
auto outerPrec = inOuterPrec;
bool needClose = maybeEmitParens(outerPrec, prec);
+
emitOperand(object, leftSide(outerPrec, prec));
m_writer->emit("->");
m_writer->emit(getName(methodKey));
@@ -1634,10 +1634,19 @@ void CLikeSourceEmitter::emitCallExpr(IRCall* inst, EmitOpInfo outerPrec)
// Detect if this is a call into a COM interface method.
if (funcValue->getOp() == kIROp_lookup_interface_method)
{
- const auto operand0TypeOp = funcValue->getOperand(0)->getDataType()->getOp();
-
- switch (operand0TypeOp)
+ auto operand0Type = funcValue->getOperand(0)->getDataType();
+ switch (operand0Type->getOp())
{
+ case kIROp_WitnessTableIDType:
+ case kIROp_WitnessTableType:
+ if (as<IRWitnessTableTypeBase>(operand0Type)
+ ->getConformanceType()
+ ->findDecoration<IRComInterfaceDecoration>())
+ {
+ emitComInterfaceCallExpr(inst, outerPrec);
+ return;
+ }
+ break;
case kIROp_ComPtrType:
case kIROp_PtrType:
case kIROp_NativePtrType: