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 /tools/gfx/renderer-shared.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 'tools/gfx/renderer-shared.h')
| -rw-r--r-- | tools/gfx/renderer-shared.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/tools/gfx/renderer-shared.h b/tools/gfx/renderer-shared.h index 01111e292..c7137f0fa 100644 --- a/tools/gfx/renderer-shared.h +++ b/tools/gfx/renderer-shared.h @@ -4,8 +4,7 @@ #include "slang-context.h" #include "core/slang-basic.h" #include "core/slang-com-object.h" - -#include "persistent-shader-cache.h" +#include "core/slang-persistent-cache.h" #include "resource-desc-utils.h" @@ -28,7 +27,7 @@ struct GfxGUID static const Slang::Guid IID_ITextureResource; static const Slang::Guid IID_IInputLayout; static const Slang::Guid IID_IDevice; - static const Slang::Guid IID_IShaderCacheStatistics; + static const Slang::Guid IID_IShaderCache; static const Slang::Guid IID_IShaderObjectLayout; static const Slang::Guid IID_IShaderObject; static const Slang::Guid IID_IRenderPassLayout; @@ -1214,7 +1213,7 @@ public: // Renderer implementation shared by all platforms. // Responsible for shader compilation, specialization and caching. -class RendererBase : public IDevice, public IShaderCacheStatistics, public Slang::ComObject +class RendererBase : public IDevice, public IShaderCache, public Slang::ComObject { friend class ShaderObjectBase; public: @@ -1354,27 +1353,21 @@ public: ShaderObjectLayoutBase* layout, IShaderObject** outObject) = 0; + public: + // IShaderCache interface + virtual SLANG_NO_THROW Result SLANG_MCALL clearShaderCache() SLANG_OVERRIDE; + virtual SLANG_NO_THROW Result SLANG_MCALL getShaderCacheStats(ShaderCacheStats* outStats) SLANG_OVERRIDE; + virtual SLANG_NO_THROW Result SLANG_MCALL resetShaderCacheStats() SLANG_OVERRIDE; + protected: virtual SLANG_NO_THROW SlangResult SLANG_MCALL initialize(const Desc& desc); protected: Slang::List<Slang::String> m_features; - -public: - virtual SLANG_NO_THROW GfxCount SLANG_MCALL getCacheMissCount() override; - virtual SLANG_NO_THROW GfxCount SLANG_MCALL getCacheHitCount() override; - virtual SLANG_NO_THROW GfxCount SLANG_MCALL getCacheEntryDirtyCount() override; - virtual SLANG_NO_THROW Result SLANG_MCALL resetCacheStatistics() override; - -protected: - GfxCount shaderCacheMissCount = 0; - GfxCount shaderCacheHitCount = 0; - GfxCount shaderCacheEntryDirtyCount = 0; - public: SlangContext slangContext; ShaderCache shaderCache; - RefPtr<PersistentShaderCache> persistentShaderCache = nullptr; + Slang::RefPtr<Slang::PersistentCache> persistentShaderCache; Slang::Dictionary<slang::TypeLayoutReflection*, Slang::RefPtr<ShaderObjectLayoutBase>> m_shaderObjectLayoutCache; Slang::ComPtr<IPipelineCreationAPIDispatcher> m_pipelineCreationAPIDispatcher; |
