From d01b0bf60fba2101e45cfac1e5747edcdbab5fc1 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 19 Jul 2017 20:35:17 +1000 Subject: VideoCommon: Move shader cache filename generation to common --- Source/Core/VideoBackends/Vulkan/ObjectCache.cpp | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/ObjectCache.cpp') 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 { 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 disk_data; LinearDiskCache disk_cache; @@ -671,15 +663,18 @@ struct ShaderCacheReader : public LinearDiskCacheReader void ObjectCache::LoadShaderCaches() { ShaderCacheReader 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 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 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(m_ps_cache.shader_map.size())); -- cgit v1.2.3