summaryrefslogtreecommitdiff
path: root/src/video_core/macro/macro.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/macro/macro.cpp')
-rw-r--r--src/video_core/macro/macro.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/video_core/macro/macro.cpp b/src/video_core/macro/macro.cpp
index 505d81c1e..82ad0477d 100644
--- a/src/video_core/macro/macro.cpp
+++ b/src/video_core/macro/macro.cpp
@@ -12,7 +12,9 @@
12#include "common/assert.h" 12#include "common/assert.h"
13#include "common/fs/fs.h" 13#include "common/fs/fs.h"
14#include "common/fs/path_util.h" 14#include "common/fs/path_util.h"
15#include "common/microprofile.h"
15#include "common/settings.h" 16#include "common/settings.h"
17#include "video_core/engines/maxwell_3d.h"
16#include "video_core/macro/macro.h" 18#include "video_core/macro/macro.h"
17#include "video_core/macro/macro_hle.h" 19#include "video_core/macro/macro_hle.h"
18#include "video_core/macro/macro_interpreter.h" 20#include "video_core/macro/macro_interpreter.h"
@@ -21,6 +23,8 @@
21#include "video_core/macro/macro_jit_x64.h" 23#include "video_core/macro/macro_jit_x64.h"
22#endif 24#endif
23 25
26MICROPROFILE_DEFINE(MacroHLE, "GPU", "Execute macro HLE", MP_RGB(128, 192, 192));
27
24namespace Tegra { 28namespace Tegra {
25 29
26static void Dump(u64 hash, std::span<const u32> code) { 30static void Dump(u64 hash, std::span<const u32> code) {
@@ -40,8 +44,8 @@ static void Dump(u64 hash, std::span<const u32> code) {
40 macro_file.write(reinterpret_cast<const char*>(code.data()), code.size_bytes()); 44 macro_file.write(reinterpret_cast<const char*>(code.data()), code.size_bytes());
41} 45}
42 46
43MacroEngine::MacroEngine(Engines::Maxwell3D& maxwell3d) 47MacroEngine::MacroEngine(Engines::Maxwell3D& maxwell3d_)
44 : hle_macros{std::make_unique<Tegra::HLEMacro>(maxwell3d)} {} 48 : hle_macros{std::make_unique<Tegra::HLEMacro>(maxwell3d_)}, maxwell3d{maxwell3d_} {}
45 49
46MacroEngine::~MacroEngine() = default; 50MacroEngine::~MacroEngine() = default;
47 51
@@ -59,8 +63,10 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) {
59 if (compiled_macro != macro_cache.end()) { 63 if (compiled_macro != macro_cache.end()) {
60 const auto& cache_info = compiled_macro->second; 64 const auto& cache_info = compiled_macro->second;
61 if (cache_info.has_hle_program) { 65 if (cache_info.has_hle_program) {
66 MICROPROFILE_SCOPE(MacroHLE);
62 cache_info.hle_program->Execute(parameters, method); 67 cache_info.hle_program->Execute(parameters, method);
63 } else { 68 } else {
69 maxwell3d.RefreshParameters();
64 cache_info.lle_program->Execute(parameters, method); 70 cache_info.lle_program->Execute(parameters, method);
65 } 71 }
66 } else { 72 } else {
@@ -101,12 +107,15 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) {
101 } 107 }
102 } 108 }
103 109
104 if (auto hle_program = hle_macros->GetHLEProgram(cache_info.hash)) { 110 auto hle_program = hle_macros->GetHLEProgram(cache_info.hash);
111 if (!hle_program || Settings::values.disable_macro_hle) {
112 maxwell3d.RefreshParameters();
113 cache_info.lle_program->Execute(parameters, method);
114 } else {
105 cache_info.has_hle_program = true; 115 cache_info.has_hle_program = true;
106 cache_info.hle_program = std::move(hle_program); 116 cache_info.hle_program = std::move(hle_program);
117 MICROPROFILE_SCOPE(MacroHLE);
107 cache_info.hle_program->Execute(parameters, method); 118 cache_info.hle_program->Execute(parameters, method);
108 } else {
109 cache_info.lle_program->Execute(parameters, method);
110 } 119 }
111 } 120 }
112} 121}