mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 01:25:51 +00:00
GPU: Elide VRAM copies when they will have no effect
Can provide a performance boost in most games because of the redundant copy they issue once a frame.
This commit is contained in:
parent
5a9abd55a1
commit
c03c4cb95a
|
@ -602,8 +602,15 @@ bool GPU::HandleCopyRectangleVRAMToVRAMCommand()
|
|||
Log_DebugPrintf("Copy rectangle from VRAM to VRAM src=(%u,%u), dst=(%u,%u), size=(%u,%u)", src_x, src_y, dst_x, dst_y,
|
||||
width, height);
|
||||
|
||||
FlushRender();
|
||||
CopyVRAM(src_x, src_y, dst_x, dst_y, width, height);
|
||||
// Some VRAM copies aren't going to do anything. Most games seem to send a 2x2 VRAM copy at the end of a frame.
|
||||
const bool skip_copy =
|
||||
width == 0 || height == 0 || (src_x == dst_x && src_y == dst_y && !m_GPUSTAT.set_mask_while_drawing);
|
||||
if (!skip_copy)
|
||||
{
|
||||
FlushRender();
|
||||
CopyVRAM(src_x, src_y, dst_x, dst_y, width, height);
|
||||
}
|
||||
|
||||
m_stats.num_vram_copies++;
|
||||
AddCommandTicks(width * height * 2);
|
||||
EndCommand();
|
||||
|
|
Loading…
Reference in a new issue