summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-module-library.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-module-library.cpp')
-rw-r--r--source/slang/slang-module-library.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/source/slang/slang-module-library.cpp b/source/slang/slang-module-library.cpp
index c03d5c2dd..c3f4a1349 100644
--- a/source/slang/slang-module-library.cpp
+++ b/source/slang/slang-module-library.cpp
@@ -39,8 +39,8 @@ void* ModuleLibrary::castAs(const Guid& guid)
}
SlangResult loadModuleLibrary(
- const Byte* inBytes,
- size_t bytesCount,
+ const Byte* inData,
+ size_t dataSize,
String path,
EndToEndCompileRequest* req,
ComPtr<IModuleLibrary>& outLibrary)
@@ -51,32 +51,38 @@ SlangResult loadModuleLibrary(
ComPtr<IModuleLibrary> scopeLibrary(library);
// Load up the module
- MemoryStreamBase memoryStream(FileAccess::Read, inBytes, bytesCount);
-
- RiffContainer riffContainer;
- SLANG_RETURN_ON_FAIL(RiffUtil::read(&memoryStream, riffContainer));
+ auto rootChunk = RIFF::RootChunk::getFromBlob(inData, dataSize);
+ if (!rootChunk)
+ {
+ return SLANG_FAIL;
+ }
auto linkage = req->getLinkage();
auto sink = req->getSink();
auto namePool = req->getNamePool();
- auto container = ContainerChunkRef::find(&riffContainer);
+ auto container = ContainerChunk::find(rootChunk);
+ if (!container)
+ {
+ return SLANG_FAIL;
+ }
- for (auto moduleChunk : container.getModules())
+ for (auto moduleChunk : container->getModules())
{
- auto loadedModule = linkage->findOrLoadSerializedModuleForModuleLibrary(moduleChunk, sink);
+ auto loadedModule =
+ linkage->findOrLoadSerializedModuleForModuleLibrary(moduleChunk, container, sink);
if (!loadedModule)
return SLANG_FAIL;
library->m_modules.add(loadedModule);
}
- for (auto entryPointChunk : container.getEntryPoints())
+ for (auto entryPointChunk : container->getEntryPoints())
{
FrontEndCompileRequest::ExtraEntryPointInfo entryPointInfo;
- entryPointInfo.mangledName = entryPointChunk.getMangledName();
- entryPointInfo.name = namePool->getName(entryPointChunk.getName());
- entryPointInfo.profile = entryPointChunk.getProfile();
+ entryPointInfo.mangledName = entryPointChunk->getMangledName();
+ entryPointInfo.name = namePool->getName(entryPointChunk->getName());
+ entryPointInfo.profile = entryPointChunk->getProfile();
library->m_entryPoints.add(entryPointInfo);
}