aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/macro.cpp
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-28 20:43:00 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-28 20:43:00 -0400
commite4deef6ba4ea76aac997ed3102f8e9801fd170b9 (patch)
treeb80a4d69bdbfafc82f6d828f1f7ae069c81184ad /src/video_core/macro.cpp
parent2bd0285a383652b086f51ef779f083f0bce62670 (diff)
Native MME: decode each instruction once; reuse the parameter FIFO
The Turing macro interpreter re-extracted every field of each 96-bit instruction on every execution and copied the register file per instruction; title 1's GPU thread spent about half its busy time there. Instructions are now decoded once per PC (re-decoded when their words change) and both lanes' operands are read up front instead of copying the registers. The parameter FIFO is a member instead of a vector allocated per macro call. Rendering checked unchanged on the attract loop; the GPU thread went from ~68% to ~45-50% busy.
Diffstat (limited to 'src/video_core/macro.cpp')
-rw-r--r--src/video_core/macro.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp
index d70cfefd2f..d3ba353ca0 100644
--- a/src/video_core/macro.cpp
+++ b/src/video_core/macro.cpp
@@ -1354,7 +1354,9 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u
}
LOG_DEBUG(HW_GPU, "Native MME context={:#x}", context);
LOG_DEBUG(HW_GPU, "Native MME start={:#x}, parameters={}, data={:08x}", method, parameters.size(), fmt::join(parameters, ","));
- std::vector<u32> fifo(parameters.begin(), parameters.end());
+ // Reused between calls (a macro never calls another: methods >= 0xe00 are refused below).
+ auto& fifo = native_fifo;
+ fifo.assign(parameters.begin(), parameters.end());
native_interpreter.active_dram = &maxwell3d.GetNativeDataRam();
const auto result = native_interpreter.Execute(native_code, method, fifo,
[&](u32 address) { return address < Maxwell3D::Regs::NUM_REGS ? maxwell3d.GetRegisterValue(address) : 0U; },