From 7092ba84803e036ec06a4f2200b79f784d278dad Mon Sep 17 00:00:00 2001 From: James Rowe Date: Mon, 9 Sep 2019 19:05:20 -0600 Subject: [PATCH] Only add shaders to precompiled cache if they are new --- .../renderer_opengl/gl_shader_manager.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp index f9c06aedd..f8f3264cb 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.cpp +++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp @@ -573,20 +573,23 @@ void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading, result = r; } else { // Unsupported shader type got stored somehow so nuke the cache - LOG_CRITICAL(Frontend, "failed to load raw programtype {}", - static_cast(raw.GetProgramType())); + LOG_ERROR(Frontend, "failed to load raw programtype {}", + static_cast(raw.GetProgramType())); compilation_failed = true; return; } if (handle == 0) { - LOG_CRITICAL(Frontend, "compilation from raw failed {:x} {:x}", - raw.GetProgramCode().at(0), raw.GetProgramCode().at(1)); + LOG_ERROR(Frontend, "compilation from raw failed {:x} {:x}", + raw.GetProgramCode().at(0), raw.GetProgramCode().at(1)); compilation_failed = true; return; } - disk_cache.SaveDecompiled(unique_identifier, *result); - disk_cache.SaveDump(unique_identifier, handle); - precompiled_cache_altered = true; + // If this is a new shader, add it the precompiled cache + if (result) { + disk_cache.SaveDecompiled(unique_identifier, *result); + disk_cache.SaveDump(unique_identifier, handle); + precompiled_cache_altered = true; + } if (callback) { callback(VideoCore::LoadCallbackStage::Build, i, raws.size());