mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 10:21:21 +00:00
RSX shaders cache: group programs by indexes
This commit is contained in:
parent
086e1c34dd
commit
4d88296485
@ -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 +
|
||||
|
@ -32,12 +32,14 @@ namespace rsx
|
||||
{
|
||||
struct entry_t
|
||||
{
|
||||
std::int64_t index;
|
||||
decompiled_shader decompiled;
|
||||
std::unordered_map<program_state, complete_shader, hasher> complete;
|
||||
};
|
||||
|
||||
std::unordered_map<raw_shader, entry_t, hasher> m_entries;
|
||||
std::string m_path;
|
||||
std::int64_t m_index = -1;
|
||||
|
||||
public:
|
||||
void path(const std::string &path_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user