From 9c8fab83a53c43e345566c35f87c16fe7b815e01 Mon Sep 17 00:00:00 2001 From: jarcherNV Date: Thu, 12 Jun 2025 19:14:49 -0700 Subject: Fix API changes from separate debugging support (#7397) Recent separate debugging support added two new functions which broke backwards compatibility. This change restores the old API and moves the new functions to an IComponentType2 interface which can be used if separate debug files are needed. --- include/slang.h | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/slang.h b/include/slang.h index 9797ea00c..b9fe732c0 100644 --- a/include/slang.h +++ b/include/slang.h @@ -4408,16 +4408,6 @@ struct IComponentType : public ISlangUnknown SlangInt targetIndex, IMetadata** outMetadata, IBlob** outDiagnostics = nullptr) = 0; - - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCompileResult( - SlangInt targetIndex, - ICompileResult** outCompileResult, - IBlob** outDiagnostics = nullptr) = 0; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCompileResult( - SlangInt entryPointIndex, - SlangInt targetIndex, - ICompileResult** outCompileResult, - IBlob** outDiagnostics = nullptr) = 0; }; #define SLANG_UUID_IComponentType IComponentType::getTypeGuid() @@ -4436,6 +4426,35 @@ struct ITypeConformance : public IComponentType }; #define SLANG_UUID_ITypeConformance ITypeConformance::getTypeGuid() +/** IComponentType2 is a component type used for getting separate debug data. + +This interface is used for getting separate debug data, introduced here to +avoid breaking backwards compatibility of the IComponentType interface. + +The `getTargetCompileResult` and `getEntryPointCompileResult` functions +are used to get the base and debug spirv, and metadata containing the +debug build identifier. +*/ +struct IComponentType2 : public ISlangUnknown +{ + SLANG_COM_INTERFACE( + 0x9c2a4b3d, + 0x7f68, + 0x4e91, + {0xa5, 0x2c, 0x8b, 0x19, 0x3e, 0x45, 0x7a, 0x9f}) + + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCompileResult( + SlangInt targetIndex, + ICompileResult** outCompileResult, + IBlob** outDiagnostics = nullptr) = 0; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCompileResult( + SlangInt entryPointIndex, + SlangInt targetIndex, + ICompileResult** outCompileResult, + IBlob** outDiagnostics = nullptr) = 0; +}; + #define SLANG_UUID_IComponentType2 IComponentType2::getTypeGuid() + /** A module is the granularity of shader code compilation and loading. In most cases a module corresponds to a single compile "translation unit." -- cgit v1.2.3