Skip to content

Commit 95797b0

Browse files
committed
GPU: Force early run on GP0 FIFO overflow
And don't crash if a game spams GP0 writes and it overflows.
1 parent 9939f1c commit 95797b0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/core/gpu.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,19 @@ void GPU::WriteRegister(u32 offset, u32 value)
531531
if (m_gpu_dump) [[unlikely]]
532532
m_gpu_dump->WriteGP0Packet(value);
533533

534+
// FIFO can be overflowed through direct GP0 writes if the command tick event hasn't run, because
535+
// there's no backpressure applied to the CPU. Instead force the GPU to run and catch up.
536+
if (m_fifo.GetSize() >= m_fifo_size) [[unlikely]]
537+
{
538+
s_command_tick_event.InvokeEarly();
539+
540+
if (m_fifo.GetSize() >= m_fifo.GetCapacity()) [[unlikely]]
541+
{
542+
WARNING_LOG("GPU FIFO overflow via GP0 write, size={}", m_fifo.GetSize());
543+
return;
544+
}
545+
}
546+
534547
m_fifo.Push(value);
535548
ExecuteCommands();
536549
return;

0 commit comments

Comments
 (0)