diff options
| author | skallweitNV <64953474+skallweitNV@users.noreply.github.com> | 2022-12-12 19:25:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-12 10:25:48 -0800 |
| commit | c2dc1a86ed2f5e160749fe9f99b70db6c3e4d7a6 (patch) | |
| tree | ea65b9635d892917a2420688a27c38537c4758be /source/core/slang-io.h | |
| parent | 8d359fc6133fa49d2d3b7f8bb4b37916e719c344 (diff) | |
Refactor shader cache (#2558)
* Fix a bug in Path::find
* Fix code formatting
* Fix LockFile and add LockFileGuard
* Add PersistentCache and unit test
* Replace file path dependency list with source file dependency list
* Add note on ordering in Module/FileDependencyList
* Remove old shader cache code
* Refactor shader cache implementation
* Temporarily skip unit tests reading/writing files
* Fix warning
* Reenable lock file test
* Rename shader cache tests and disable crashing test
* Testing
* Stop using Path::getCanonical
* Fix persistent cache lock and test
* Fix threading issues
* Move adding file dependency hashes to getEntryPointHash()
* Fix handling of #include files
* Allow specifying additional search paths for gfx testing device
* Work on shader cache tests
* Update project files
* Revive shader cache graphics tests
* Split graphics pipeline test
* Fix compilation
Diffstat (limited to 'source/core/slang-io.h')
| -rw-r--r-- | source/core/slang-io.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/source/core/slang-io.h b/source/core/slang-io.h index fc5cbfa9d..e766359ff 100644 --- a/source/core/slang-io.h +++ b/source/core/slang-io.h @@ -266,9 +266,9 @@ namespace Slang private: LockFile(const LockFile&) = delete; - LockFile(LockFile&) = delete; + LockFile(LockFile&&) = delete; LockFile& operator=(const LockFile&) = delete; - LockFile& operator=(const LockFile&&) = delete; + LockFile& operator=(LockFile&&) = delete; #if SLANG_WINDOWS_FAMILY void* m_fileHandle; @@ -278,6 +278,29 @@ namespace Slang bool m_isOpen; }; + class LockFileGuard + { + public: + LockFileGuard(LockFile& lockFile, LockFile::LockType lockType = LockFile::LockType::Exclusive) + : m_lockFile(lockFile) + { + m_lockFile.lock(lockType); + } + + ~LockFileGuard() + { + m_lockFile.unlock(); + } + + private: + LockFileGuard(const LockFileGuard&) = delete; + LockFileGuard(LockFileGuard&&) = delete; + LockFileGuard& operator=(const LockFileGuard&) = delete; + LockFileGuard& operator=(LockFileGuard&&) = delete; + + LockFile& m_lockFile; + }; + } #endif |
