0
0
mirror of https://notabug.org/litucks/torzu.git synced 2025-04-28 09:35:26 +00:00

perf(VideoCore): Refactor DispatchIndirect

- Added automatic safe or unsafe processing for better emulation accuracy.

ref: 8cae0310e3
This commit is contained in:
EmulationEnjoyer 2024-11-12 21:28:47 +00:00 committed by spectranator
parent 154aab7c4b
commit 247f61e1f9

View File

@ -76,13 +76,7 @@ bool DmaPusher::Step() {
return true; return true;
} }
// Push buffer non-empty, read a word // Determine whether to use safe or unsafe processing
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));
}
}
const auto safe_process = [&] { const auto safe_process = [&] {
Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader,
Tegra::Memory::GuestMemoryFlags::SafeRead> Tegra::Memory::GuestMemoryFlags::SafeRead>
@ -90,6 +84,7 @@ bool DmaPusher::Step() {
&command_headers); &command_headers);
ProcessCommands(headers); ProcessCommands(headers);
}; };
const auto unsafe_process = [&] { const auto unsafe_process = [&] {
Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader,
Tegra::Memory::GuestMemoryFlags::UnsafeRead> Tegra::Memory::GuestMemoryFlags::UnsafeRead>
@ -97,14 +92,13 @@ bool DmaPusher::Step() {
&command_headers); &command_headers);
ProcessCommands(headers); ProcessCommands(headers);
}; };
if (Settings::IsGPULevelHigh()) {
if (dma_state.method >= MacroRegistersStart) { if (Settings::IsGPULevelHigh() || (dma_state.method >= MacroRegistersStart)) {
unsafe_process();
return true;
}
safe_process(); safe_process();
return true; return true;
} }
unsafe_process(); unsafe_process();
} }
return true; return true;