summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-spirv-ops-debug-info-ext.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-02-28 22:57:07 -0800
committerGitHub <noreply@github.com>2024-02-28 22:57:07 -0800
commit73a61edda8893901acad05bb4e7d3110db5041a8 (patch)
treebb6331b28715a4e95fcd7724ad338149ce56e562 /source/slang/slang-emit-spirv-ops-debug-info-ext.h
parentd2644e2f8f0abb73bbd6afd70816f6bf245340da (diff)
[SPIRV] Add NonSemanticDebugInfo for step-through debugging. (#3644)
* [SPIRV] Add NonSemanticDebugInfo for step-through debugging. * Fix. * Fix.
Diffstat (limited to 'source/slang/slang-emit-spirv-ops-debug-info-ext.h')
-rw-r--r--source/slang/slang-emit-spirv-ops-debug-info-ext.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/source/slang/slang-emit-spirv-ops-debug-info-ext.h b/source/slang/slang-emit-spirv-ops-debug-info-ext.h
index d1ca9665a..3d2a10aab 100644
--- a/source/slang/slang-emit-spirv-ops-debug-info-ext.h
+++ b/source/slang/slang-emit-spirv-ops-debug-info-ext.h
@@ -24,5 +24,104 @@ SpvInst* emitOpDebugLine(SpvInstParent* parent, IRInst* inst, const T& idResultT
return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(103), source, lineStart, lineEnd, colStart, colEnd);
}
+// https://github.com/KhronosGroup/SPIRV-Registry/blob/main/nonsemantic/NonSemantic.Shader.DebugInfo.100.asciidoc#DebugFunction
+template<typename T>
+SpvInst* emitOpDebugFunction(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* name, SpvInst* type, IRInst* source, IRInst* lineStart, IRInst* colStart, SpvInst* scope, IRInst* linkageName, IRInst* flag, IRInst* scopeLine)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(20), name, type, source, lineStart, colStart, scope, linkageName, flag, scopeLine);
+}
+
+template<typename T>
+SpvInst* emitOpDebugFunctionDefinition(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, SpvInst* debugFunc, SpvInst* spvFunc)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(101), debugFunc, spvFunc);
+}
+
+template<typename T, typename Ts>
+SpvInst* emitOpDebugTypeFunction(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* flags, SpvInst* returnType, const Ts& argTypes)
+{
+ static_assert(isSingular<T>);
+ static_assert(isPlural<Ts>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(8), flags, returnType, argTypes);
+}
+
+template<typename T, typename Ts>
+SpvInst* emitOpDebugTypeComposite(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* name, IRInst* tag, IRInst* source, IRInst* line, IRInst* col, SpvInst* scope, IRInst* linkageName, IRInst* size, IRInst* flags, const Ts& members)
+{
+ static_assert(isSingular<T>);
+ static_assert(isPlural<Ts>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(10), name, tag, source, line, col, scope, linkageName, size, flags, members);
+}
+
+template<typename T>
+SpvInst* emitOpDebugTypeMember(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* name, SpvInst* type, IRInst* source, IRInst* line, IRInst* col, IRInst* offset, IRInst* size, IRInst* flags)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(11), name, type, source, line, col, offset, size, flags);
+}
+
+template<typename T>
+SpvInst* emitOpDebugTypeArray(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, SpvInst* baseType, IRInst* elementCount)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(5), baseType, elementCount);
+}
+
+template<typename T>
+SpvInst* emitOpDebugTypeBasic(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* name, IRInst* size, IRInst* encoding, IRInst* flags)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(2), name, size, encoding, flags);
+}
+
+template<typename T>
+SpvInst* emitOpDebugTypeVector(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, SpvInst* baseType, IRInst* elementCount)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(6), baseType, elementCount);
+}
+
+template<typename T>
+SpvInst* emitOpDebugTypeMatrix(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, SpvInst* vectorType, IRInst* vectorCount, IRInst* columnMajor)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(108), vectorType, vectorCount, columnMajor);
+}
+
+template<typename T>
+SpvInst* emitOpDebugScope(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, SpvInst* scope)
+{
+ static_assert(isSingular<T>);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(23), scope);
+}
+
+template<typename T>
+SpvInst* emitOpDebugLocalVariable(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* name, SpvInst* type, IRInst* source, IRInst* line, IRInst* col, SpvInst* scope, IRInst* flags, IRInst* argIndex)
+{
+ static_assert(isSingular<T>);
+ if (argIndex)
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(26), name, type, source, line, col, scope, flags, argIndex);
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(26), name, type, source, line, col, scope, flags);
+}
+
+template<typename T, typename Ts>
+SpvInst* emitOpDebugValue(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, IRInst* localVar, IRInst* value, SpvInst* expression, const Ts& indices)
+{
+ static_assert(isSingular<T>);
+ static_assert(isPlural<Ts>);
+
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(29), localVar, value, expression, indices);
+}
+
+template<typename T, typename Ts>
+SpvInst* emitOpDebugExpression(SpvInstParent* parent, IRInst* inst, const T& idResultType, SpvInst* set, const Ts& operations)
+{
+ static_assert(isSingular<T>);
+ static_assert(isPlural<Ts>);
+
+ return emitInst(parent, inst, SpvOpExtInst, idResultType, kResultID, set, SpvWord(31), operations);
+}
#endif // SLANG_IN_SPIRV_EMIT_CONTEXT