summaryrefslogtreecommitdiff
path: root/source/slang/slang-compiler.h
diff options
context:
space:
mode:
authorjarcherNV <jarcher@nvidia.com>2025-06-06 14:30:06 -0700
committerGitHub <noreply@github.com>2025-06-06 14:30:06 -0700
commit0d16228ae22fa2e1a00e62dc099eea08da7717fe (patch)
tree067573914132892dc1336dcdea2c8b595f24f871 /source/slang/slang-compiler.h
parent649d533727b31b28397ffb3a530e655ac3861547 (diff)
Add command line option for separate debug info (#7178)
* Add command line option for separate debug info Add command line arg -separate-debug-info which, if provided, produces both a .spv and a .dbg.spv file. The .dbg.spv file contains full debug info and the .spv file has all debug info stripped out. Also add a DebugBuildIdentifier instruction to store a unique hash in both the output files, so they can be more easily matched together. A matching API is provided to allow using the Slang API to retrieve a base and debug SPIRV as well as the debug build identifier string.
Diffstat (limited to 'source/slang/slang-compiler.h')
-rw-r--r--source/slang/slang-compiler.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 861719aac..24ddd00cc 100644
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -324,6 +324,16 @@ public:
slang::IMetadata** outMetadata,
slang::IBlob** outDiagnostics = nullptr) SLANG_OVERRIDE;
+ SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCompileResult(
+ SlangInt entryPointIndex,
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE;
+ SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCompileResult(
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics = nullptr) SLANG_OVERRIDE;
+
SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem(
SlangInt entryPointIndex,
SlangInt targetIndex,
@@ -974,6 +984,27 @@ public:
return Super::getTargetMetadata(targetIndex, outMetadata, outDiagnostics);
}
+ SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCompileResult(
+ SlangInt entryPointIndex,
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
+ {
+ return Super::getEntryPointCompileResult(
+ entryPointIndex,
+ targetIndex,
+ outCompileResult,
+ outDiagnostics);
+ }
+
+ SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCompileResult(
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
+ {
+ return Super::getTargetCompileResult(targetIndex, outCompileResult, outDiagnostics);
+ }
+
SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem(
SlangInt entryPointIndex,
SlangInt targetIndex,
@@ -1253,6 +1284,27 @@ public:
return Super::getTargetMetadata(targetIndex, outMetadata, outDiagnostics);
}
+ SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCompileResult(
+ SlangInt entryPointIndex,
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
+ {
+ return Super::getEntryPointCompileResult(
+ entryPointIndex,
+ targetIndex,
+ outCompileResult,
+ outDiagnostics);
+ }
+
+ SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCompileResult(
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
+ {
+ return Super::getTargetCompileResult(targetIndex, outCompileResult, outDiagnostics);
+ }
+
SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem(
SlangInt entryPointIndex,
SlangInt targetIndex,
@@ -1581,6 +1633,27 @@ public:
return Super::getTargetMetadata(targetIndex, outMetadata, outDiagnostics);
}
+ SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCompileResult(
+ SlangInt entryPointIndex,
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
+ {
+ return Super::getEntryPointCompileResult(
+ entryPointIndex,
+ targetIndex,
+ outCompileResult,
+ outDiagnostics);
+ }
+
+ SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCompileResult(
+ SlangInt targetIndex,
+ slang::ICompileResult** outCompileResult,
+ slang::IBlob** outDiagnostics) SLANG_OVERRIDE
+ {
+ return Super::getTargetCompileResult(targetIndex, outCompileResult, outDiagnostics);
+ }
+
/// Get a serialized representation of the checked module.
virtual SLANG_NO_THROW SlangResult SLANG_MCALL
serialize(ISlangBlob** outSerializedBlob) override;
@@ -3356,6 +3429,10 @@ private:
/// Maybe write the artifact to the path (if set), or stdout (if there is no container or path)
SlangResult _maybeWriteArtifact(const String& path, IArtifact* artifact);
+ SlangResult _maybeWriteDebugArtifact(
+ TargetProgram* targetProgram,
+ const String& path,
+ IArtifact* artifact);
SlangResult _writeArtifact(const String& path, IArtifact* artifact);
/// Adds any extra settings to complete a targetRequest