diff --git a/rpcs3/Emu/RSX/rsx_cache.cpp b/rpcs3/Emu/RSX/rsx_cache.cpp index 6a391d9251..2ff2ecfafe 100644 --- a/rpcs3/Emu/RSX/rsx_cache.cpp +++ b/rpcs3/Emu/RSX/rsx_cache.cpp @@ -25,7 +25,7 @@ namespace rsx //analyze_raw_shader(raw_shader); std::string shader_name_base = - fmt::format("%016llx", raw_shader.hash()) + + fmt::format("%lld.%016llx", ++m_index, raw_shader.hash()) + (raw_shader.type == rsx::program_type::fragment ? ".fp" : ".vp"); fs::file{ m_path + shader_name_base + ".ucode", fs::rewrite } @@ -36,7 +36,7 @@ namespace rsx fs::file{ m_path + shader_name_base + (ctxt.lang == rsx::decompile_language::glsl ? ".glsl" : ".hlsl"), fs::rewrite } .write(decompiled_shader.code); - auto inserted = m_entries.insert({ raw_shader, entry_t{ decompiled_shader } }).first; + auto inserted = m_entries.insert({ raw_shader, entry_t{ m_index, decompiled_shader } }).first; inserted->second.decompiled.raw = &inserted->first; entry = &inserted->second; } @@ -56,7 +56,7 @@ namespace rsx info.complete = &entry->complete.insert({ state, complete_shader }).first->second; info.complete->user_data = nullptr; - const std::string hash_combination = fmt::format("%016llx.%016llx", raw_shader.hash(), state.hash()); + const std::string hash_combination = fmt::format("%lld.%016llx.%016llx", entry->index, raw_shader.hash(), state.hash()); std::string shader_name = hash_combination + diff --git a/rpcs3/Emu/RSX/rsx_cache.h b/rpcs3/Emu/RSX/rsx_cache.h index 8b69f15e30..6fc12d683f 100644 --- a/rpcs3/Emu/RSX/rsx_cache.h +++ b/rpcs3/Emu/RSX/rsx_cache.h @@ -32,12 +32,14 @@ namespace rsx { struct entry_t { + std::int64_t index; decompiled_shader decompiled; std::unordered_map complete; }; std::unordered_map m_entries; std::string m_path; + std::int64_t m_index = -1; public: void path(const std::string &path_);