summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 05c525965..1c01478ed 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -2055,6 +2055,7 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO
case kIROp_MatrixReshape:
case kIROp_CastPtrToInt:
case kIROp_CastIntToPtr:
+ case kIROp_PtrCast:
{
// Simple constructor call
auto prec = getInfo(EmitOp::Prefix);
@@ -2345,6 +2346,15 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO
m_writer->emit(".detach()");
break;
}
+ case kIROp_GetOffsetPtr:
+ {
+ auto prec = getInfo(EmitOp::Add);
+ needClose = maybeEmitParens(outerPrec, prec);
+ emitOperand(inst->getOperand(0), leftSide(outerPrec, prec));
+ m_writer->emit(" + ");
+ emitOperand(inst->getOperand(1), rightSide(prec, outerPrec));
+ break;
+ }
case kIROp_GetElement:
case kIROp_GetElementPtr:
case kIROp_ImageSubscript:
@@ -4097,7 +4107,8 @@ void CLikeSourceEmitter::ensureGlobalInst(ComputeEmitActionsContext* ctx, IRInst
}
if (as<IRBasicType>(inst))
return;
-
+ if (as<IRPtrLit>(inst))
+ return;
// Certain inst ops will always emit as definition.
switch (inst->getOp())
{