From d93f5f9f8415c5f6f160bbbd1a43fbee27c761d2 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 13 Apr 2026 01:07:31 +0300 Subject: [PATCH] vk: Implement variant recompilation for performance --- rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp index f0723080f5..316071abe7 100644 --- a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp +++ b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp @@ -471,7 +471,11 @@ namespace vk m_vs_shader_cache.clear(); m_fs_shader_cache.clear(); - vkDestroyPipelineCache(m_device, m_driver_pipeline_cache, nullptr); + if (m_driver_pipeline_cache) + { + vkDestroyPipelineCache(m_device, m_driver_pipeline_cache, nullptr); + m_driver_pipeline_cache = VK_NULL_HANDLE; + } } std::shared_ptr shader_interpreter::link(const vk::pipeline_props& properties, u64 compiler_opt, bool async, async_build_fn_callback async_callback) @@ -609,6 +613,13 @@ namespace vk if (found != m_program_cache.end()) [[likely]] { m_current_interpreter = found->second.program; + + if ((found->second.flags & (CACHED_PIPE_UNOPTIMIZED | CACHED_PIPE_RECOMPILING)) == CACHED_PIPE_UNOPTIMIZED) + { + found->second.flags |= CACHED_PIPE_RECOMPILING; + link(properties, key.compiler_opt, true, {}); + } + return m_current_interpreter.get(); } }