diff options
| author | 2023-08-19 01:19:49 +0100 | |
|---|---|---|
| committer | 2023-08-25 21:47:47 -0400 | |
| commit | d7a0b8c373526c07c1edddbcdc6e20cc4c9e759c (patch) | |
| tree | 06c7c5701475c5cff367c39081f6386a842f401c /src | |
| parent | Merge pull request #11278 from Kelebek1/dma_sync (diff) | |
| download | yuzu-d7a0b8c373526c07c1edddbcdc6e20cc4c9e759c.tar.gz yuzu-d7a0b8c373526c07c1edddbcdc6e20cc4c9e759c.tar.xz yuzu-d7a0b8c373526c07c1edddbcdc6e20cc4c9e759c.zip | |
Mark decompiled macros as decompiled on dump, dump shaders after translation
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/macro/macro.cpp | 24 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 7 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp index 905505ca1..5d0bb9cc4 100644 --- a/src/video_core/macro/macro.cpp +++ b/src/video_core/macro/macro.cpp | |||
| @@ -27,14 +27,24 @@ MICROPROFILE_DEFINE(MacroHLE, "GPU", "Execute macro HLE", MP_RGB(128, 192, 192)) | |||
| 27 | 27 | ||
| 28 | namespace Tegra { | 28 | namespace Tegra { |
| 29 | 29 | ||
| 30 | static void Dump(u64 hash, std::span<const u32> code) { | 30 | static void Dump(u64 hash, std::span<const u32> code, bool decompiled = false) { |
| 31 | const auto base_dir{Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)}; | 31 | const auto base_dir{Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)}; |
| 32 | const auto macro_dir{base_dir / "macros"}; | 32 | const auto macro_dir{base_dir / "macros"}; |
| 33 | if (!Common::FS::CreateDir(base_dir) || !Common::FS::CreateDir(macro_dir)) { | 33 | if (!Common::FS::CreateDir(base_dir) || !Common::FS::CreateDir(macro_dir)) { |
| 34 | LOG_ERROR(Common_Filesystem, "Failed to create macro dump directories"); | 34 | LOG_ERROR(Common_Filesystem, "Failed to create macro dump directories"); |
| 35 | return; | 35 | return; |
| 36 | } | 36 | } |
| 37 | const auto name{macro_dir / fmt::format("{:016x}.macro", hash)}; | 37 | auto name{macro_dir / fmt::format("{:016x}.macro", hash)}; |
| 38 | |||
| 39 | if (decompiled) { | ||
| 40 | auto new_name{macro_dir / fmt::format("decompiled_{:016x}.macro", hash)}; | ||
| 41 | if (Common::FS::Exists(name)) { | ||
| 42 | (void)Common::FS::RenameFile(name, new_name); | ||
| 43 | return; | ||
| 44 | } | ||
| 45 | name = new_name; | ||
| 46 | } | ||
| 47 | |||
| 38 | std::fstream macro_file(name, std::ios::out | std::ios::binary); | 48 | std::fstream macro_file(name, std::ios::out | std::ios::binary); |
| 39 | if (!macro_file) { | 49 | if (!macro_file) { |
| 40 | LOG_ERROR(Common_Filesystem, "Unable to open or create file at {}", | 50 | LOG_ERROR(Common_Filesystem, "Unable to open or create file at {}", |
| @@ -90,9 +100,6 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) { | |||
| 90 | if (!mid_method.has_value()) { | 100 | if (!mid_method.has_value()) { |
| 91 | cache_info.lle_program = Compile(macro_code->second); | 101 | cache_info.lle_program = Compile(macro_code->second); |
| 92 | cache_info.hash = Common::HashValue(macro_code->second); | 102 | cache_info.hash = Common::HashValue(macro_code->second); |
| 93 | if (Settings::values.dump_macros) { | ||
| 94 | Dump(cache_info.hash, macro_code->second); | ||
| 95 | } | ||
| 96 | } else { | 103 | } else { |
| 97 | const auto& macro_cached = uploaded_macro_code[mid_method.value()]; | 104 | const auto& macro_cached = uploaded_macro_code[mid_method.value()]; |
| 98 | const auto rebased_method = method - mid_method.value(); | 105 | const auto rebased_method = method - mid_method.value(); |
| @@ -102,9 +109,6 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) { | |||
| 102 | code.size() * sizeof(u32)); | 109 | code.size() * sizeof(u32)); |
| 103 | cache_info.hash = Common::HashValue(code); | 110 | cache_info.hash = Common::HashValue(code); |
| 104 | cache_info.lle_program = Compile(code); | 111 | cache_info.lle_program = Compile(code); |
| 105 | if (Settings::values.dump_macros) { | ||
| 106 | Dump(cache_info.hash, code); | ||
| 107 | } | ||
| 108 | } | 112 | } |
| 109 | 113 | ||
| 110 | auto hle_program = hle_macros->GetHLEProgram(cache_info.hash); | 114 | auto hle_program = hle_macros->GetHLEProgram(cache_info.hash); |
| @@ -117,6 +121,10 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) { | |||
| 117 | MICROPROFILE_SCOPE(MacroHLE); | 121 | MICROPROFILE_SCOPE(MacroHLE); |
| 118 | cache_info.hle_program->Execute(parameters, method); | 122 | cache_info.hle_program->Execute(parameters, method); |
| 119 | } | 123 | } |
| 124 | |||
| 125 | if (Settings::values.dump_macros) { | ||
| 126 | Dump(cache_info.hash, macro_code->second, cache_info.has_hle_program); | ||
| 127 | } | ||
| 120 | } | 128 | } |
| 121 | } | 129 | } |
| 122 | 130 | ||
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index c1314ca99..fe432dfe1 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -611,9 +611,6 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( | |||
| 611 | 611 | ||
| 612 | const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; | 612 | const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; |
| 613 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); | 613 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); |
| 614 | if (Settings::values.dump_shaders) { | ||
| 615 | env.Dump(hash, key.unique_hashes[index]); | ||
| 616 | } | ||
| 617 | if (!uses_vertex_a || index != 1) { | 614 | if (!uses_vertex_a || index != 1) { |
| 618 | // Normal path | 615 | // Normal path |
| 619 | programs[index] = TranslateProgram(pools.inst, pools.block, env, cfg, host_info); | 616 | programs[index] = TranslateProgram(pools.inst, pools.block, env, cfg, host_info); |
| @@ -624,6 +621,10 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( | |||
| 624 | programs[index] = MergeDualVertexPrograms(program_va, program_vb, env); | 621 | programs[index] = MergeDualVertexPrograms(program_va, program_vb, env); |
| 625 | } | 622 | } |
| 626 | 623 | ||
| 624 | if (Settings::values.dump_shaders) { | ||
| 625 | env.Dump(hash, key.unique_hashes[index]); | ||
| 626 | } | ||
| 627 | |||
| 627 | if (programs[index].info.requires_layer_emulation) { | 628 | if (programs[index].info.requires_layer_emulation) { |
| 628 | layer_source_program = &programs[index]; | 629 | layer_source_program = &programs[index]; |
| 629 | } | 630 | } |