From e95bc52b3ddb6cdc82092fbbcc6d6d5b10e66094 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Thu, 16 Jan 2020 08:35:52 -0700 Subject: [PATCH] Only check for sanitize_mul if theres a shader in the cache --- .../renderer_opengl/gl_shader_disk_cache.cpp | 2 -- src/video_core/renderer_opengl/gl_shader_manager.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 66a06ceaf..1e8ca1041 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp @@ -203,12 +203,10 @@ ShaderDiskCache::LoadPrecompiledFile(FileUtil::IOFile& file) { ShaderCacheVersionHash file_hash{}; if (!LoadArrayFromPrecompiled(file_hash.data(), file_hash.size())) { - decompressed_precompiled_cache_offset = 0; return {}; } if (GetShaderCacheVersionHash() != file_hash) { LOG_INFO(Render_OpenGL, "Precompiled cache is from another version of the emulator"); - decompressed_precompiled_cache_offset = 0; return {}; } diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp index 89fb52f73..d51e4be56 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.cpp +++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp @@ -491,14 +491,14 @@ void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading, const auto dump{dumps.find(unique_identifier)}; const auto decomp{decompiled.find(unique_identifier)}; - // Only load this shader if its sanitize_mul setting matches - if (decomp->second.sanitize_mul == VideoCore::g_hw_shader_accurate_mul) { - continue; - } - OGLProgram shader; if (dump != dumps.end() && decomp != decompiled.end()) { + // Only load this shader if its sanitize_mul setting matches + if (decomp->second.sanitize_mul == VideoCore::g_hw_shader_accurate_mul) { + continue; + } + // If the shader is dumped, attempt to load it shader = GeneratePrecompiledProgram(dump->second, supported_formats); if (shader.handle == 0) {