aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/macro.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/macro.cpp')
-rw-r--r--src/video_core/macro.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp
index 50e32ce999..74e25da067 100644
--- a/src/video_core/macro.cpp
+++ b/src/video_core/macro.cpp
@@ -17,6 +17,7 @@
#ifdef ARCHITECTURE_x86_64
#include "common/x64/xbyak.h"
+#include "video_core/macro_turing_jit.h"
#endif
#include "common/assert.h"
@@ -1459,6 +1460,33 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u
}
return true;
};
+#ifdef ARCHITECTURE_x86_64
+ // Macro code runs compiled to x86-64 (macro_turing_jit.h) instead of through the memo
+ // and the interpreter; EDEN_NX2_MME_JIT=0 goes back to those.
+ static const bool use_jit = [] {
+ const char* value = std::getenv("EDEN_NX2_MME_JIT");
+ return value == nullptr || value[0] != '0';
+ }();
+ if (use_jit) {
+ if (!native_jit) {
+ native_jit = std::make_shared<TuringMacroJit>();
+ }
+ native_jit->Prepare(native_code, native_code_generation);
+ fifo.assign(parameters.begin(), parameters.end());
+ const auto result = native_jit->Execute(
+ method, fifo, std::span<u32>{*native_interpreter.active_dram},
+ [&](u32 address) {
+ return address < Maxwell3D::Regs::NUM_REGS ? maxwell3d.GetRegisterValue(address) : 0U;
+ },
+ emit);
+ if (!result.success) {
+ native_execution_failed = true;
+ LOG_ERROR(HW_GPU, "Native MME (JIT) failed: start={:#x}, consumed={}/{}, error={}",
+ method, result.consumed, parameters.size(), result.error);
+ }
+ return;
+ }
+#endif
// EDEN_NX2_MME_MEMO=0: interpret every call (see macro_memo.h).
static const bool use_memo = [] {
const char* value = std::getenv("EDEN_NX2_MME_MEMO");