diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-11-01 15:57:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-01 15:57:51 -0400 |
| commit | 608b7fba5411f9de2193ac604d38363463807410 (patch) | |
| tree | c2f34e81b6fe137b59c2cc99064fd6ed3d2a33f3 /source/slang/slang.cpp | |
| parent | 068f2a2552ba49335a8a1e72e1731d047335fe82 (diff) | |
Using repro as a file system (#1104)
* Added RiffReadHelper
* Move type to fourCC in Chunk simplifies some code.
* Make MemoryArena able to track external blocks.
Allow ownership of Data to vary.
Changed IR serialization to use moved allocations to avoid copies.
As it turns out all of the array writes could use unowned data, but doing so requires the IRData to stay in scope longer than IRSerialData, which it does at the moment - but perhaps needs better naming or a control for the feature.
* Write out slang-module container.
* WIP on -r option.
Loading modules - with -r.
* Making the serialized-module run (without using imported module).
* Split compiling module from the test.
* Separate module compilation with a function working.
* Remove serialization test as not used.
* Fix warning on gcc.
* Updated test to have types across module boundary.
* Allow entry point declaration.
A test that tries to build with just an entry point declaration and a module.
* Try to make link work with multiple modules.
* Multi module linking first pass working.
* Multi module test working with -module-name option
* Added feature to repro manifest of approximation of command line that was used.
* Use isDefinition - for determining to add decorations to entry point lowering.
* Added support for repo-file-system.h
More precise control of CacheFileSystem.
Allow RelativeFileSystem to strip paths optionally.
Use canonical paths in PathInfo cache.
Fix bug in -D options for command line output of StateSerailizeUtil
* Add missing slang-options.h
* Fix bug in bit slang-state-serialize.cpp with bit removal.
* Added documentation around -repro-file-system
Added spLoadReproAsFileSystem function.
* Fix warning.
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index c7171d835..946d7337b 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -3574,6 +3574,33 @@ SLANG_API SlangResult spExtractRepro(SlangSession* session, const void* reproDat return StateSerializeUtil::extractFiles(base, requestState, fileSystem); } +SLANG_API SlangResult spLoadReproAsFileSystem( + SlangSession* session, + const void* reproData, + size_t reproDataSize, + ISlangFileSystem* replaceFileSystem, + ISlangFileSystemExt** outFileSystem) +{ + using namespace Slang; + + SLANG_UNUSED(session); + + MemoryStreamBase stream(FileAccess::Read, reproData, reproDataSize); + + List<uint8_t> buffer; + SLANG_RETURN_ON_FAIL(StateSerializeUtil::loadState(&stream, buffer)); + + auto requestState = StateSerializeUtil::getRequest(buffer); + MemoryOffsetBase base; + base.set(buffer.getBuffer(), buffer.getCount()); + + RefPtr<CacheFileSystem> cacheFileSystem; + SLANG_RETURN_ON_FAIL(StateSerializeUtil::loadFileSystem(base, requestState, replaceFileSystem, cacheFileSystem)); + + *outFileSystem = cacheFileSystem.detach(); + return SLANG_OK; +} + // Reflection API SLANG_API SlangResult spCompileRequest_getProgram( |
