From f521c2002e6b664944c6c39bab767dca1802887a Mon Sep 17 00:00:00 2001 From: cheneym2 Date: Fri, 4 Oct 2024 10:20:57 -0400 Subject: Add interfaces for retrieving separate linkable downstream binaries (#5128) * Implement separate downstream library interface Create a new com interface to house the methods for precompiling slang modules to target code. Add methods to count dependent modules and scrape them for downstream target binaries such that the downstream target binaries are linkabe outside of slang, e.g. via spirv-link or dxc. Fixes #5147 * Rename to _Experimental Clearly identify this as an interface subject to change. --- include/slang.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/slang.h b/include/slang.h index 81b3ac1cb..6e4ab6250 100644 --- a/include/slang.h +++ b/include/slang.h @@ -5601,13 +5601,34 @@ namespace slang SlangInt32 index) = 0; virtual SLANG_NO_THROW DeclReflection* SLANG_MCALL getModuleReflection() = 0; + }; + + #define SLANG_UUID_IModule IModule::getTypeGuid() + + /* Experimental interface for doing target precompilation of slang modules */ + struct IModulePrecompileService_Experimental : public ISlangUnknown + { + //uuidgen output: 8e12e8e3 - 5fcd - 433e - afcb - 13a088bc5ee5 + SLANG_COM_INTERFACE(0x8e12e8e3, 0x5fcd, 0x433e, { 0xaf, 0xcb, 0x13, 0xa0, 0x88, 0xbc, 0x5e, 0xe5 }) virtual SLANG_NO_THROW SlangResult SLANG_MCALL precompileForTarget( SlangCompileTarget target, ISlangBlob** outDiagnostics) = 0; + + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getPrecompiledTargetCode( + SlangCompileTarget target, + IBlob** outCode, + IBlob** outDiagnostics = nullptr) = 0; + + virtual SLANG_NO_THROW SlangInt SLANG_MCALL getModuleDependencyCount() = 0; + + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getModuleDependency( + SlangInt dependencyIndex, + IModule** outModule, + IBlob** outDiagnostics = nullptr) = 0; }; - - #define SLANG_UUID_IModule IModule::getTypeGuid() + + #define SLANG_UUID_IModulePrecompileService_Experimental IModulePrecompileService_Experimental::getTypeGuid() /** Argument used for specialization to types/values. */ -- cgit v1.2.3