summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-emit-metal.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/slang/slang-emit-metal.cpp b/source/slang/slang-emit-metal.cpp
index e6e2a3ec5..45a9e60ad 100644
--- a/source/slang/slang-emit-metal.cpp
+++ b/source/slang/slang-emit-metal.cpp
@@ -701,6 +701,21 @@ bool MetalSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inO
m_writer->emit(")");
return true;
}
+ case kIROp_Neg:
+ {
+ if (as<IRMatrixType>(inst->getOperand(0)->getDataType()))
+ {
+ // Metal does not support negate operator on matrices,
+ // we should emit "(matrix(0) - op0)" instead.
+ m_writer->emit("(");
+ emitType(inst->getDataType());
+ m_writer->emit("(0) - ");
+ emitOperand(inst->getOperand(0), getInfo(EmitOp::General));
+ m_writer->emit(")");
+ return true;
+ }
+ break;
+ }
case kIROp_Mul:
{
// Component-wise multiplication needs to be special cased,