summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar MerryMage2020-06-15 20:03:32 +0100
committerGravatar MerryMage2020-06-17 17:17:08 +0100
commit44f10d9b9f4ac6fb718718a85a5916721e7944e4 (patch)
tree47d821ca6d98a0b8edcb0db01c4e99a48692dfc7 /src
parentMerge pull request #4086 from MerryMage/abi (diff)
downloadyuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.gz
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.tar.xz
yuzu-44f10d9b9f4ac6fb718718a85a5916721e7944e4.zip
macro_jit_x64: Inline Engines::Maxwell3D::GetRegisterValue
Diffstat (limited to 'src')
-rw-r--r--src/video_core/macro/macro_jit_x64.cpp23
-rw-r--r--src/video_core/macro/macro_jit_x64.h1
2 files changed, 18 insertions, 6 deletions
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp
index d4a97ec7b..0b2918388 100644
--- a/src/video_core/macro/macro_jit_x64.cpp
+++ b/src/video_core/macro/macro_jit_x64.cpp
@@ -295,12 +295,20 @@ void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) {
295 sub(result, opcode.immediate * -1); 295 sub(result, opcode.immediate * -1);
296 } 296 }
297 } 297 }
298 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 298
299 mov(Common::X64::ABI_PARAM1, qword[STATE]); 299 // Equivalent to Engines::Maxwell3D::GetRegisterValue:
300 mov(Common::X64::ABI_PARAM2, RESULT); 300 if (optimizer.enable_asserts) {
301 Common::X64::CallFarFunction(*this, &Read); 301 Xbyak::Label pass_range_check;
302 Common::X64::ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 302 cmp(RESULT, static_cast<u32>(Engines::Maxwell3D::Regs::NUM_REGS));
303 mov(RESULT, Common::X64::ABI_RETURN.cvt32()); 303 jb(pass_range_check);
304 int3();
305 L(pass_range_check);
306 }
307 mov(rax, qword[STATE]);
308 mov(RESULT,
309 dword[rax + offsetof(Engines::Maxwell3D, regs) +
310 offsetof(Engines::Maxwell3D::Regs, reg_array) + RESULT.cvt64() * sizeof(u32)]);
311
304 Compile_ProcessResult(opcode.result_operation, opcode.dst); 312 Compile_ProcessResult(opcode.result_operation, opcode.dst);
305} 313}
306 314
@@ -435,6 +443,9 @@ void MacroJITx64Impl::Compile() {
435 // one if our register isn't "dirty" 443 // one if our register isn't "dirty"
436 optimizer.optimize_for_method_move = true; 444 optimizer.optimize_for_method_move = true;
437 445
446 // Enable run-time assertions in JITted code
447 optimizer.enable_asserts = false;
448
438 // Check to see if we can skip emitting certain instructions 449 // Check to see if we can skip emitting certain instructions
439 Optimizer_ScanFlags(); 450 Optimizer_ScanFlags();
440 451
diff --git a/src/video_core/macro/macro_jit_x64.h b/src/video_core/macro/macro_jit_x64.h
index 51ec090b8..a180e7428 100644
--- a/src/video_core/macro/macro_jit_x64.h
+++ b/src/video_core/macro/macro_jit_x64.h
@@ -76,6 +76,7 @@ private:
76 bool zero_reg_skip{}; 76 bool zero_reg_skip{};
77 bool skip_dummy_addimmediate{}; 77 bool skip_dummy_addimmediate{};
78 bool optimize_for_method_move{}; 78 bool optimize_for_method_move{};
79 bool enable_asserts{};
79 }; 80 };
80 OptimizerState optimizer{}; 81 OptimizerState optimizer{};
81 82