summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-spirv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
-rw-r--r--source/slang/slang-emit-spirv.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index d6f4ac176..0facaac3f 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -4032,6 +4032,9 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
case kIROp_GetOffsetPtr:
result = emitGetOffsetPtr(parent, inst);
break;
+ case kIROp_MeshOutputRef:
+ result = emitMeshOutputRef(parent, inst);
+ break;
case kIROp_GetElement:
result = emitGetElement(parent, as<IRGetElement>(inst));
break;
@@ -7002,6 +7005,19 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
makeArray(inst->getIndex()));
}
+ SpvInst* emitMeshOutputRef(SpvInstParent* parent, IRInst* inst)
+ {
+ // MeshOutputRef takes two operands: the mesh output array and the index
+ // It should return a reference (address) to the element at that index
+ auto base = inst->getOperand(0);
+ auto index = inst->getOperand(1);
+
+ const SpvWord baseId = getID(ensureInst(base));
+
+ // Use OpAccessChain to get the address of the element
+ return emitOpAccessChain(parent, inst, inst->getFullType(), baseId, makeArray(index));
+ }
+
SpvInst* emitGetElement(SpvInstParent* parent, IRGetElement* inst)
{
requireVariableBufferCapabilityIfNeeded(inst->getDataType());