diff options
| author | Stenzek <stenzek@gmail.com> | 2017-07-19 20:35:17 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-07-20 17:46:59 +1000 |
| commit | d01b0bf60fba2101e45cfac1e5747edcdbab5fc1 (patch) | |
| tree | 2b6d657f96bd62a4c9bf336583590548f19f47f1 /Source/Core/VideoBackends/Vulkan/ObjectCache.cpp | |
| parent | 7c5bbafdd119e3b8975d7b49411dd89e7770baab (diff) | |
VideoCommon: Move shader cache filename generation to common
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/ObjectCache.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/ObjectCache.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp index d63533b7f4..15c73c5098 100644 --- a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp @@ -446,16 +446,6 @@ void ObjectCache::ClearPipelineCache() m_compute_pipeline_objects.clear(); } -std::string ObjectCache::GetDiskCacheFileName(const char* type, bool include_gameid, - bool include_host_config) -{ - return StringFromFormat( - "%svulkan-%s%s%s%s%s.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(), type, - include_gameid ? "-" : "", include_gameid ? SConfig::GetInstance().GetGameID().c_str() : "", - include_host_config ? "-" : "", - include_host_config ? g_ActiveConfig.GetHostConfigFilename().c_str() : ""); -} - class PipelineCacheReadCallback : public LinearDiskCacheReader<u32, u8> { public: @@ -482,7 +472,8 @@ bool ObjectCache::CreatePipelineCache() // Vulkan pipeline caches can be shared between games for shader compile time reduction. // This assumes that drivers don't create all pipelines in the cache on load time, only // when a lookup occurs that matches a pipeline (or pipeline data) in the cache. - m_pipeline_cache_filename = GetDiskCacheFileName("pipeline", false, true); + m_pipeline_cache_filename = + g_ActiveConfig.GetDiskCacheFileName(APIType::Vulkan, "Pipeline", false, true); VkPipelineCacheCreateInfo info = { VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // VkStructureType sType @@ -505,7 +496,8 @@ bool ObjectCache::LoadPipelineCache() { // We have to keep the pipeline cache file name around since when we save it // we delete the old one, by which time the game's unique ID is already cleared. - m_pipeline_cache_filename = GetDiskCacheFileName("pipeline", false, true); + m_pipeline_cache_filename = + g_ActiveConfig.GetDiskCacheFileName(APIType::Vulkan, "Pipeline", false, true); std::vector<u8> disk_data; LinearDiskCache<u32, u8> disk_cache; @@ -671,15 +663,18 @@ struct ShaderCacheReader : public LinearDiskCacheReader<Uid, u32> void ObjectCache::LoadShaderCaches() { ShaderCacheReader<VertexShaderUid> vs_reader(m_vs_cache.shader_map); - m_vs_cache.disk_cache.OpenAndRead(GetDiskCacheFileName("vs", true, true), vs_reader); + m_vs_cache.disk_cache.OpenAndRead( + g_ActiveConfig.GetDiskCacheFileName(APIType::Vulkan, "VS", true, true), vs_reader); ShaderCacheReader<PixelShaderUid> ps_reader(m_ps_cache.shader_map); - m_ps_cache.disk_cache.OpenAndRead(GetDiskCacheFileName("ps", true, true), ps_reader); + m_ps_cache.disk_cache.OpenAndRead( + g_ActiveConfig.GetDiskCacheFileName(APIType::Vulkan, "PS", true, true), ps_reader); if (g_vulkan_context->SupportsGeometryShaders()) { ShaderCacheReader<GeometryShaderUid> gs_reader(m_gs_cache.shader_map); - m_gs_cache.disk_cache.OpenAndRead(GetDiskCacheFileName("gs", true, true), gs_reader); + m_gs_cache.disk_cache.OpenAndRead( + g_ActiveConfig.GetDiskCacheFileName(APIType::Vulkan, "GS", true, true), gs_reader); } SETSTAT(stats.numPixelShadersCreated, static_cast<int>(m_ps_cache.shader_map.size())); |
