From 7c5bbafdd119e3b8975d7b49411dd89e7770baab Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 30 Jun 2017 14:37:41 +1000 Subject: [PATCH] Vulkan: Don't save/load pipeline UID cache when shader cache is disabled --- Source/Core/VideoBackends/Vulkan/StateTracker.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp index 01b6065f3c..97ad7d4461 100644 --- a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp +++ b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp @@ -143,13 +143,16 @@ void StateTracker::ReloadPipelineUIDCache() StateTracker* this_ptr; }; + m_uid_cache.Sync(); + m_uid_cache.Close(); + // UID caches don't contain any host state, so use a single uid cache per gameid. std::string filename = g_object_cache->GetDiskCacheFileName("pipeline-uid", true, false); - PipelineInserter inserter(this); - - // 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); + if (g_ActiveConfig.bShaderCache) + { + PipelineInserter inserter(this); + m_uid_cache.OpenAndRead(filename, inserter); + } } void StateTracker::AppendToPipelineUIDCache(const PipelineInfo& info) @@ -887,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;