summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/StateTracker.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-06-30 14:37:41 +1000
committerStenzek <stenzek@gmail.com>2017-07-20 17:46:59 +1000
commit7c5bbafdd119e3b8975d7b49411dd89e7770baab (patch)
tree545691e1101700b6ed3709c6664274a45ea0c7b1 /Source/Core/VideoBackends/Vulkan/StateTracker.cpp
parentb380f292b47c8b1a3e1711a665a3469074715485 (diff)
Vulkan: Don't save/load pipeline UID cache when shader cache is disabled
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/StateTracker.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/StateTracker.cpp15
1 files 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;