Vulkan: Don't save/load pipeline UID cache when shader cache is disabled

This commit is contained in:
Stenzek 2017-06-30 14:37:41 +10:00
parent b380f292b4
commit 7c5bbafdd1
1 changed files with 9 additions and 6 deletions

View File

@ -143,14 +143,17 @@ void StateTracker::ReloadPipelineUIDCache()
StateTracker* this_ptr; 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. // 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); std::string filename = g_object_cache->GetDiskCacheFileName("pipeline-uid", true, false);
if (g_ActiveConfig.bShaderCache)
{
PipelineInserter inserter(this); 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); m_uid_cache.OpenAndRead(filename, inserter);
} }
}
void StateTracker::AppendToPipelineUIDCache(const PipelineInfo& info) void StateTracker::AppendToPipelineUIDCache(const PipelineInfo& info)
{ {
@ -887,7 +890,7 @@ VkPipeline StateTracker::GetPipelineAndCacheUID(const PipelineInfo& info)
auto result = g_object_cache->GetPipelineWithCacheResult(info); auto result = g_object_cache->GetPipelineWithCacheResult(info);
// Add to the UID cache if it is a new pipeline. // Add to the UID cache if it is a new pipeline.
if (!result.second) if (!result.second && g_ActiveConfig.bShaderCache)
AppendToPipelineUIDCache(info); AppendToPipelineUIDCache(info);
return result.first; return result.first;