mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 05:28:56 +02:00
Update src/video_core/dma_pusher.cpp
Upon investigating ender magnolia crashes i need to add lots of instrumentation in the "if (header.size > 0) {...}" block (between headers(...) and ProcessCommands(...)) for both safe and unsafe paths. The old way i need to add same instrumentation twice, always ending up maintaining only one path, and when i realize i need to test the other, i have to update/copy/move instrumentation between methods.
This new writing preserves exactly the same logic, but gathers both paths into a single one, and by no means should have performance impact.
And it's more elegant too. You're welcome ^^.
We must let the compiler do the hard work for us, right?
Feel free to blame!
Signed-off-by: xbzk <xbzk@eden-emu.dev>
This commit is contained in:
parent
963f9981ce
commit
991512af4c
1 changed files with 10 additions and 8 deletions
|
|
@ -78,17 +78,19 @@ bool DmaPusher::Step() {
|
|||
synced = false;
|
||||
}
|
||||
|
||||
if (header.size > 0 && dma_state.method >= MacroRegistersStart && subchannels[dma_state.subchannel]) {
|
||||
subchannels[dma_state.subchannel]->current_dirty = memory_manager.IsMemoryDirty(dma_state.dma_get, header.size * sizeof(u32));
|
||||
}
|
||||
|
||||
if (header.size > 0) {
|
||||
if (Settings::IsDMALevelDefault() ? (Settings::IsGPULevelMedium() || Settings::IsGPULevelHigh()) : Settings::IsDMALevelSafe()) {
|
||||
Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, Tegra::Memory::GuestMemoryFlags::SafeRead>headers(memory_manager, dma_state.dma_get, header.size, &command_headers);
|
||||
if (dma_state.method >= MacroRegistersStart && subchannels[dma_state.subchannel]) {
|
||||
subchannels[dma_state.subchannel]->current_dirty = memory_manager.IsMemoryDirty(dma_state.dma_get, header.size * sizeof(u32));
|
||||
}
|
||||
auto run = [&]<Tegra::Memory::GuestMemoryFlags Flags>() {
|
||||
Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, Flags>
|
||||
headers(memory_manager, dma_state.dma_get, header.size, &command_headers);
|
||||
ProcessCommands(headers);
|
||||
};
|
||||
if (Settings::IsDMALevelSafe() || (Settings::IsDMALevelDefault() && !Settings::IsGPULevelLow())) {
|
||||
run.template operator()<Tegra::Memory::GuestMemoryFlags::SafeRead>();
|
||||
} else {
|
||||
Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, Tegra::Memory::GuestMemoryFlags::UnsafeRead>headers(memory_manager, dma_state.dma_get, header.size, &command_headers);
|
||||
ProcessCommands(headers);
|
||||
run.template operator()<Tegra::Memory::GuestMemoryFlags::UnsafeRead>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue