summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 3b39c1cb1..5b2ae6d19 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -1831,6 +1831,40 @@ void GLSLSourceEmitter::emitVectorTypeNameImpl(IRType* elementType, IRIntegerVal
}
}
+void GLSLSourceEmitter::emitTypeImpl(IRType* type, const StringSliceLoc* nameAndLoc)
+{
+ if (auto refType = as<IRRefType>(type))
+ {
+ m_writer->emit("spirv_by_reference ");
+ type = refType->getValueType();
+ }
+ return Super::emitTypeImpl(type, nameAndLoc);
+}
+
+void GLSLSourceEmitter::emitParamTypeImpl(IRType* type, String const& name)
+{
+ if (auto refType = as<IRRefType>(type))
+ {
+ //
+ m_writer->emit("spirv_by_reference ");
+ type = refType->getValueType();
+ }
+ Super::emitParamTypeImpl(type, name);
+}
+
+void GLSLSourceEmitter::emitFuncDecorationImpl(IRDecoration* decoration)
+{
+ if (decoration->getOp() == kIROp_SPIRVOpDecoration)
+ {
+ m_writer->emit("spirv_instruction(id = ");
+ emitSimpleValue(decoration->getOperand(0));
+ m_writer->emit(")\n");
+ }
+ else
+ {
+ Super::emitFuncDecorationImpl(decoration);
+ }
+}
void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
{