From a0994a8da142e54362e9ec1fdb5e5abc708ec3d2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 18 Jan 2023 00:01:58 -0500 Subject: Add `set` to spirv_instruction (#2597) --- source/slang/slang-emit-glsl.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/slang/slang-emit-glsl.cpp') diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index b1b92e7e7..13eb6e2f6 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -1999,6 +1999,22 @@ void GLSLSourceEmitter::emitFuncDecorationImpl(IRDecoration* decoration) m_writer->emit("spirv_instruction(id = "); emitSimpleValue(decoration->getOperand(0)); + + if (decoration->getOperandCount() >= 2) + { + if (auto stringLit = as(decoration->getOperand(1))) + { + m_writer->emit(toSlice(", set = ")); + + auto handler = StringEscapeUtil::getHandler(StringEscapeUtil::Style::Cpp); + + StringBuilder buf; + StringEscapeUtil::appendQuoted(handler, stringLit->getStringSlice(), buf); + + m_writer->emitRawTextSpan(buf.begin(), buf.end()); + } + } + m_writer->emit(")\n"); } else -- cgit v1.2.3