summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-module-library.cpp
diff options
context:
space:
mode:
authorTheresa Foley <10618364+tangent-vector@users.noreply.github.com>2025-05-12 10:28:05 -0700
committerGitHub <noreply@github.com>2025-05-12 17:28:05 +0000
commit4c76b275907cf2d764f3fc51468d1c58635a10c1 (patch)
tree201a353c2b64b258760c370e641821ec5f6eff85 /source/slang/slang-module-library.cpp
parent6b286bfbdf85e40cac1ee325384f535df969938a (diff)
Cleanups related to RIFF support (#7041)
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);
}