diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2024-10-25 10:14:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-25 10:14:22 -0700 |
| commit | 4bad669bbc5ec3ff77321f083c59cde87eb10229 (patch) | |
| tree | bf0abc916692cf34e804469bba400f2b04172472 /source/slang/slang-api.cpp | |
| parent | ef40d3044cf75ec3d7b24a43257fa744b45274f9 (diff) | |
Replace stdlib on Slang API with CoreModule (#5405)
This is a breaking change in a way that the Slang API function names are changed. All of them are commented as "experimental" and we wouldn't provide a back-ward compatibility for them.
Following functions are renamed:
compileStdLib() -> compileCoreModule()
loadStdLib() -> loadCoreModule()
saveStdLib() -> saveCoreModule()
slang_createGlobalSessionWithoutStdLib() -> slang_createGlobalSessionWithoutCoreModule()
slang_getEmbeddedStdLib() -> slang_getEmbeddedCoreModule()
hasDeferredStdLib() -> hasDeferredCoreModule()
Following command-line arguments are renamed:
"-load-stdlib" -> "-load-core-module"
"-save-stdlib" -> "-save-core-module"
"-save-stdlib-bin-source" -> "-save-core-module-bin-source"
"-compile-stdlib" -> "-compile-core-module"
Diffstat (limited to 'source/slang/slang-api.cpp')
| -rw-r--r-- | source/slang/slang-api.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/slang/slang-api.cpp b/source/slang/slang-api.cpp index ccecc74e1..feaca559e 100644 --- a/source/slang/slang-api.cpp +++ b/source/slang/slang-api.cpp @@ -51,7 +51,7 @@ SlangResult tryLoadStdLibFromCache( auto cacheTimestamp = *(uint64_t*)(cacheData.getData()); if (cacheTimestamp != currentLibTimestamp) return SLANG_FAIL; - SLANG_RETURN_ON_FAIL(globalSession->loadStdLib( + SLANG_RETURN_ON_FAIL(globalSession->loadCoreModule( (uint8_t*)cacheData.getData() + sizeof(uint64_t), cacheData.getSizeInBytes() - sizeof(uint64_t))); return SLANG_OK; @@ -66,7 +66,7 @@ SlangResult trySaveStdLibToCache( { Slang::ComPtr<ISlangBlob> stdLibBlobPtr; SLANG_RETURN_ON_FAIL( - globalSession->saveStdLib(SLANG_ARCHIVE_TYPE_RIFF_LZ4, stdLibBlobPtr.writeRef())); + globalSession->saveCoreModule(SLANG_ARCHIVE_TYPE_RIFF_LZ4, stdLibBlobPtr.writeRef())); Slang::FileStream fileStream; SLANG_RETURN_ON_FAIL(fileStream.init(cacheFilename, Slang::FileMode::Create)); @@ -89,13 +89,13 @@ SLANG_API SlangResult slang_createGlobalSession( Slang::_debugGetIRAllocCounter() = 0x80000000; #endif - SLANG_RETURN_ON_FAIL(slang_createGlobalSessionWithoutStdLib(apiVersion, globalSession.writeRef())); + SLANG_RETURN_ON_FAIL(slang_createGlobalSessionWithoutCoreModule(apiVersion, globalSession.writeRef())); // If we have the embedded stdlib, load from that, else compile it - ISlangBlob* stdLibBlob = slang_getEmbeddedStdLib(); + ISlangBlob* stdLibBlob = slang_getEmbeddedCoreModule(); if (stdLibBlob) { - SLANG_RETURN_ON_FAIL(globalSession->loadStdLib(stdLibBlob->getBufferPointer(), stdLibBlob->getBufferSize())); + SLANG_RETURN_ON_FAIL(globalSession->loadCoreModule(stdLibBlob->getBufferPointer(), stdLibBlob->getBufferSize())); } else { @@ -109,7 +109,7 @@ SLANG_API SlangResult slang_createGlobalSession( #endif { // Compile std lib from embeded source. - SLANG_RETURN_ON_FAIL(globalSession->compileStdLib(0)); + SLANG_RETURN_ON_FAIL(globalSession->compileCoreModule(0)); #if SLANG_PROFILE_STDLIB_COMPILE auto timeElapsed = std::chrono::high_resolution_clock::now() - startTime; printf("stdlib compilation time: %.1fms\n", timeElapsed.count() / 1000000.0); @@ -148,7 +148,7 @@ SLANG_API void slang_shutdown() Slang::freeCapabilityDefs(); } -SLANG_API SlangResult slang_createGlobalSessionWithoutStdLib( +SLANG_API SlangResult slang_createGlobalSessionWithoutCoreModule( SlangInt apiVersion, slang::IGlobalSession** outGlobalSession) { |
