diff options
| author | lucy96chen <47800040+lucy96chen@users.noreply.github.com> | 2022-10-19 09:36:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-19 09:36:41 -0700 |
| commit | dec930150f42a22892e567c769a1c9e24e761fde (patch) | |
| tree | 92eea81e0c5d08c2c5ff090e7ebb0c2030648912 /tools/gfx/persistent-shader-cache.h | |
| parent | 8add41a6e37994577d928bc312801ddfa1c33173 (diff) | |
PersistentShaderCache integration (#2453)
* Shader cache index integrated into RendererBase; Added test for cache eviction policy (which currently does not pass)
* Restructured main if block in getEntryPointCodeFromShaderCache; Post-rebase cleanup
* undo local testing only change
* Fixed issues causing shader cache tests to fail
* Edited gfx.slang to reflect structural changes to IDevice::Desc and to include ShaderCacheDesc; Modified how the cache is reading in the file from disk; Added a check to the cache eviction policy test that checks for correct order of entries in the cache as well as eight total expected output files for D3D12 and Vulkan
* Removed line in gfx-unit-test.cpp for local testing
* Edited .gitignore to ignore all shaders automatically generated by the shader cache tests and removed the test shaders that were previously added; Review changes, most notably with an overhaul of how the cache eviction policy test handles checking order of entries
* Ran premake; Removed local testing specific line (again)
* Removed expected comparison files from earlier commit; Ran premake
* Edited premake5.lua to also ignore the auto-generated shader files from specific shader cache tests
* Fixed weird indent in premake5.lua
Diffstat (limited to 'tools/gfx/persistent-shader-cache.h')
| -rw-r--r-- | tools/gfx/persistent-shader-cache.h | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/tools/gfx/persistent-shader-cache.h b/tools/gfx/persistent-shader-cache.h index 55738a9af..49a4a53dd 100644 --- a/tools/gfx/persistent-shader-cache.h +++ b/tools/gfx/persistent-shader-cache.h @@ -1,34 +1,28 @@ // slang-shader-cache-index.h #pragma once #include "../../slang.h" +#include "../../slang-gfx.h" #include "../../slang-com-ptr.h" #include "../../source/core/slang-string.h" #include "../../source/core/slang-dictionary.h" #include "../../source/core/slang-linked-list.h" -namespace Slang +namespace gfx { + using namespace Slang; + struct ShaderCacheEntry { slang::Digest dependencyBasedDigest; slang::Digest astBasedDigest; }; -class PersistentShaderCache +class PersistentShaderCache : public RefObject { public: - // TODO: Remove in integration PR in favor of new ShaderCacheDesc in slang-gfx.h - struct Desc - { - String cacheFilename; - String shaderCachePath; - SlangInt entryCountLimit = 1000; - ISlangFileSystem* shaderCacheFileSystem = nullptr; - }; - - PersistentShaderCache(const Desc& inDesc); + PersistentShaderCache(const IDevice::ShaderCacheDesc& inDesc); // Fetch the cache entry corresponding to the provided key. If found, move the entry to // the front of entries and return the entry and the corresponding compiled code in @@ -62,7 +56,7 @@ private: void deleteLRUEntry(); // The shader cache's description. - Desc desc; + IDevice::ShaderCacheDesc desc; // Dictionary mapping each shader's key to its corresponding node (entry) in the list // of entries. |
