diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-01-11 15:24:11 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-11 15:24:11 -0500 |
| commit | 723796a0a0fed8e5b8c3222b1c90443189113098 (patch) | |
| tree | 41fa039f2f2fcec4c24746203ad119a8054f021a /source/slang/slang.cpp | |
| parent | 5554777188225266e2295db3588f6cb17cae0c4d (diff) | |
LZ4 compression support (#1654)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Testing out use of lz4.
* Added ICompressionSystem, and LZ4 implementation.
* Add support for deflate compression.
Simplify compression interface - to make more easily work across apis.
* WIP on CompressedFileSystem.
* ImplicitDirectoryCollector
* SubStringIndexMap - > StringSliceIndexMap.
* WIP save stdlib in different containers.
* Support for different archive types for stdlib.
* Fix project.
* CompressedFileSystem -> ArchiveFileSystem.
Added CompressionSystemType::None
* Added ArchiveFileSystem
* Fix problem RiffFileSystem load withoug compression system.
* Test archive types.
Improve diagnostic message.
* Fix typo in testing file system archives.
* Split out archive detection.
* Fix gcc warning issue.
* Fix warning.
* RiffArchiveFileSystem -> RiffFileSystem
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index fbcc97c51..c82d5cf65 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -3,8 +3,7 @@ #include "../core/slang-io.h" #include "../core/slang-string-util.h" #include "../core/slang-shared-library.h" - -#include "../core/slang-zip-file-system.h" +#include "../core/slang-archive-file-system.h" #include "slang-check.h" #include "slang-parameter-binding.h" @@ -266,8 +265,8 @@ SlangResult Session::loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) } // Make a file system to read it from - RefPtr<CompressedFileSystem> fileSystem; - SLANG_RETURN_ON_FAIL(CompressedFileSystem::createZip(stdLib, stdLibSizeInBytes, fileSystem)); + RefPtr<ArchiveFileSystem> fileSystem; + SLANG_RETURN_ON_FAIL(loadArchiveFileSystem(stdLib, stdLibSizeInBytes, fileSystem)); // Let's try loading serialized modules and adding them SLANG_RETURN_ON_FAIL(_readBuiltinModule(fileSystem, coreLanguageScope, "core")); @@ -275,7 +274,7 @@ SlangResult Session::loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) return SLANG_OK; } -SlangResult Session::saveStdLib(ISlangBlob** outBlob) +SlangResult Session::saveStdLib(SlangArchiveType archiveType, ISlangBlob** outBlob) { if (m_builtinLinkage->mapNameToLoadedModules.Count() == 0) { @@ -284,8 +283,8 @@ SlangResult Session::saveStdLib(ISlangBlob** outBlob) } // Make a file system to read it from - RefPtr<CompressedFileSystem> fileSystem; - SLANG_RETURN_ON_FAIL(CompressedFileSystem::createZip(fileSystem)); + RefPtr<ArchiveFileSystem> fileSystem; + SLANG_RETURN_ON_FAIL(createArchiveFileSystem(archiveType, fileSystem)); for (auto& pair : m_builtinLinkage->mapNameToLoadedModules) { @@ -315,11 +314,7 @@ SlangResult Session::saveStdLib(ISlangBlob** outBlob) } // Now need to convert into a blob - auto archiveContents = fileSystem->getArchive(); - - ComPtr<ISlangBlob> blob(new RawBlob(archiveContents.getBuffer(), archiveContents.getCount())); - *outBlob = blob.detach(); - + SLANG_RETURN_ON_FAIL(fileSystem->storeArchive(true, outBlob)); return SLANG_OK; } |
