summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/D3D/PixelShaderCache.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/PixelShaderCache.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
index 289e9a32f9..d3bdce59f1 100644
--- a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
+++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
@@ -498,18 +498,29 @@ void PixelShaderCache::Init()
SETSTAT(stats.numPixelShadersAlive, 0);
if (g_ActiveConfig.bShaderCache)
- {
- if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
- File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
-
- std::string cache_filename =
- StringFromFormat("%sdx11-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(),
- SConfig::GetInstance().GetGameID().c_str());
- PixelShaderCacheInserter inserter;
- g_ps_disk_cache.OpenAndRead(cache_filename, inserter);
- }
+ LoadShaderCache();
+}
- last_entry = nullptr;
+void PixelShaderCache::LoadShaderCache()
+{
+ if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
+ File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
+
+ std::string cache_filename = StringFromFormat(
+ "%sdx11-%s-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(),
+ SConfig::GetInstance().GetGameID().c_str(), g_ActiveConfig.GetHostConfigFilename().c_str());
+ PixelShaderCacheInserter inserter;
+ g_ps_disk_cache.OpenAndRead(cache_filename, inserter);
+}
+
+void PixelShaderCache::Reload()
+{
+ g_ps_disk_cache.Sync();
+ g_ps_disk_cache.Close();
+ Clear();
+
+ if (g_ActiveConfig.bShaderCache)
+ LoadShaderCache();
}
// ONLY to be used during shutdown.
@@ -520,6 +531,7 @@ void PixelShaderCache::Clear()
PixelShaders.clear();
last_entry = nullptr;
+ last_uid = {};
}
// Used in Swap() when AA mode has changed