diff options
| author | cheneym2 <acheney@nvidia.com> | 2024-10-04 10:20:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-04 10:20:57 -0400 |
| commit | f521c2002e6b664944c6c39bab767dca1802887a (patch) | |
| tree | 7fb24ff7940a4cdee91f661e607278b4ba530944 /tools/gfx-unit-test/precompiled-module-2.cpp | |
| parent | 25c17b9fcbf7a21e9fa19c4a8f08b0406437be24 (diff) | |
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.
Diffstat (limited to 'tools/gfx-unit-test/precompiled-module-2.cpp')
| -rw-r--r-- | tools/gfx-unit-test/precompiled-module-2.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/gfx-unit-test/precompiled-module-2.cpp b/tools/gfx-unit-test/precompiled-module-2.cpp index e8ceb6f45..f997b2a7b 100644 --- a/tools/gfx-unit-test/precompiled-module-2.cpp +++ b/tools/gfx-unit-test/precompiled-module-2.cpp @@ -29,9 +29,12 @@ namespace gfx_test auto globalSession = slangSession->getGlobalSession(); globalSession->createSession(sessionDesc, slangSession.writeRef()); - Slang::ComPtr<slang::IBlob> diagnosticsBlob; - slang::IModule* module = slangSession->loadModule(shaderModuleName, diagnosticsBlob.writeRef()); - diagnoseIfNeeded(diagnosticsBlob); + slang::IModule* module; + { + Slang::ComPtr<slang::IBlob> diagnosticsBlob; + module = slangSession->loadModule(shaderModuleName, diagnosticsBlob.writeRef()); + diagnoseIfNeeded(diagnosticsBlob); + } if (!module) return SLANG_FAIL; @@ -49,7 +52,14 @@ namespace gfx_test default: return SLANG_FAIL; } - module->precompileForTarget(target, diagnosticsBlob.writeRef()); + + ComPtr<slang::IModulePrecompileService_Experimental> precompileService; + if (module->queryInterface(slang::SLANG_UUID_IModulePrecompileService_Experimental, (void**)precompileService.writeRef()) == SLANG_OK) + { + Slang::ComPtr<slang::IBlob> diagnosticsBlob; + precompileService->precompileForTarget(target, diagnosticsBlob.writeRef()); + diagnoseIfNeeded(diagnosticsBlob); + } } // Write loaded modules to memory file system. |
