From 247f61e1f927b12d3c8a958d7441edecc515d8a2 Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:28:47 +0000 Subject: [PATCH] perf(VideoCore): Refactor DispatchIndirect - Added automatic safe or unsafe processing for better emulation accuracy. ref: https://git.citron-emu.org/Citron/Citron/commit/8cae0310e3aece0135e8c8e82e5fbeb379560b78 --- src/video_core/dma_pusher.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 9051ba073..1db008120 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -76,13 +76,7 @@ bool DmaPusher::Step() { return true; } - // Push buffer non-empty, read a word - if (dma_state.method >= MacroRegistersStart) { - if (subchannels[dma_state.subchannel]) { - subchannels[dma_state.subchannel]->current_dirty = memory_manager.IsMemoryDirty( - dma_state.dma_get, command_list_header.size * sizeof(u32)); - } - } + // Determine whether to use safe or unsafe processing const auto safe_process = [&] { Tegra::Memory::GpuGuestMemory @@ -90,6 +84,7 @@ bool DmaPusher::Step() { &command_headers); ProcessCommands(headers); }; + const auto unsafe_process = [&] { Tegra::Memory::GpuGuestMemory @@ -97,14 +92,13 @@ bool DmaPusher::Step() { &command_headers); ProcessCommands(headers); }; - if (Settings::IsGPULevelHigh()) { - if (dma_state.method >= MacroRegistersStart) { - unsafe_process(); - return true; - } + + if (Settings::IsGPULevelHigh() || (dma_state.method >= MacroRegistersStart)) { + safe_process(); return true; } + unsafe_process(); } return true;