diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-07 15:00:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-07 15:00:38 -0700 |
| commit | 9eb6a84285c1597d723be13924a7ad2991cf717f (patch) | |
| tree | ad4358fb9dcbbd4b561670d02671859a217ad14a /source/slang/slang.cpp | |
| parent | 9ef9cc00d98d1775f0ad86efd246ca1605b3b3e4 (diff) | |
Fix `Val` deduplication bug. (#3050)
* Fix `Val` deduplication bug.
* Fix
* Concat stdlib files into a single module.
* Remove unnecessary logic in `resolve`.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 266533874..cb6e88db4 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -311,9 +311,13 @@ SlangResult Session::compileStdLib(slang::CompileStdLibFlags compileFlags) } // TODO(JS): Could make this return a SlangResult as opposed to exception - addBuiltinSource(coreLanguageScope, "core", getCoreLibraryCode()); - addBuiltinSource(hlslLanguageScope, "hlsl", getHLSLLibraryCode()); - addBuiltinSource(autodiffLanguageScope, "diff", getAutodiffLibraryCode()); + StringBuilder stdLibSrcBuilder; + stdLibSrcBuilder + << (const char*)getCoreLibraryCode()->getBufferPointer() + << (const char*)getHLSLLibraryCode()->getBufferPointer() + << (const char*)getAutodiffLibraryCode()->getBufferPointer(); + auto stdLibSrcBlob = StringBlob::moveCreate(stdLibSrcBuilder.produceString()); + addBuiltinSource(coreLanguageScope, "core", stdLibSrcBlob); if (compileFlags & slang::CompileStdLibFlag::WriteDocumentation) { @@ -359,6 +363,8 @@ SlangResult Session::compileStdLib(slang::CompileStdLibFlags compileFlags) SlangResult Session::loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) { + SLANG_PROFILE; + if (m_builtinLinkage->mapNameToLoadedModules.getCount()) { // Already have a StdLib loaded @@ -373,8 +379,6 @@ SlangResult Session::loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) // Let's try loading serialized modules and adding them SLANG_RETURN_ON_FAIL(_readBuiltinModule(fileSystem, coreLanguageScope, "core")); - SLANG_RETURN_ON_FAIL(_readBuiltinModule(fileSystem, hlslLanguageScope, "hlsl")); - SLANG_RETURN_ON_FAIL(_readBuiltinModule(fileSystem, autodiffLanguageScope, "diff")); return SLANG_OK; } |
