diff options
| author | Stenzek <stenzek@users.noreply.github.com> | 2017-07-27 13:30:38 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-27 13:30:38 +1000 |
| commit | a11bde7d167c65bb693e5138e47dd4586683c092 (patch) | |
| tree | 84f9128b0478b0b18e271e0426fceb499c9e72e3 /Source/Core/VideoBackends/Vulkan/StateTracker.cpp | |
| parent | 10db1bcbca947a56e872ed4b6625d9d3de31b298 (diff) | |
| parent | 3ea9d86faa2544b8c1c235db9456f271baf42fec (diff) | |
Merge pull request #5679 from stenzek/no-host-state-in-uids
ShaderGen: Decouple host state from shader UIDs
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/StateTracker.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/StateTracker.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp index 7299e981a9..0b7833be5c 100644 --- a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp +++ b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp @@ -115,7 +115,20 @@ bool StateTracker::Initialize() return true; } -void StateTracker::LoadPipelineUIDCache() +void StateTracker::InvalidateShaderPointers() +{ + // Clear UIDs, forcing a false match next time. + m_vs_uid = {}; + m_gs_uid = {}; + m_ps_uid = {}; + + // Invalidate shader pointers. + m_pipeline_state.vs = VK_NULL_HANDLE; + m_pipeline_state.gs = VK_NULL_HANDLE; + m_pipeline_state.ps = VK_NULL_HANDLE; +} + +void StateTracker::ReloadPipelineUIDCache() { class PipelineInserter final : public LinearDiskCacheReader<SerializedPipelineUID, u32> { @@ -130,12 +143,16 @@ void StateTracker::LoadPipelineUIDCache() StateTracker* this_ptr; }; - std::string filename = g_object_cache->GetDiskCacheFileName("pipeline-uid"); - PipelineInserter inserter(this); + m_uid_cache.Sync(); + m_uid_cache.Close(); - // OpenAndRead calls Close() first, which will flush all data to disk when reloading. - // This assertion must hold true, otherwise data corruption will result. - m_uid_cache.OpenAndRead(filename, inserter); + // UID caches don't contain any host state, so use a single uid cache per gameid. + std::string filename = GetDiskShaderCacheFileName(APIType::Vulkan, "PipelineUID", true, false); + if (g_ActiveConfig.bShaderCache) + { + PipelineInserter inserter(this); + m_uid_cache.OpenAndRead(filename, inserter); + } } void StateTracker::AppendToPipelineUIDCache(const PipelineInfo& info) @@ -873,7 +890,7 @@ VkPipeline StateTracker::GetPipelineAndCacheUID(const PipelineInfo& info) auto result = g_object_cache->GetPipelineWithCacheResult(info); // Add to the UID cache if it is a new pipeline. - if (!result.second) + if (!result.second && g_ActiveConfig.bShaderCache) AppendToPipelineUIDCache(info); return result.first; |
