From b03127b206e79202c098064b1c678375e75b270a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 25 Dec 2024 15:40:52 +1000 Subject: [PATCH] GPU: Move background dumping to HW+GPU thread And only dump when the mask bit check is not enabled. The replacements are gated by the mask bit check anyway, so there's no point dumping anything that can't be replaced. --- src/core/gpu_commands.cpp | 7 ------- src/core/gpu_hw.cpp | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core/gpu_commands.cpp b/src/core/gpu_commands.cpp index a57f6c421..cdcd5a4d5 100644 --- a/src/core/gpu_commands.cpp +++ b/src/core/gpu_commands.cpp @@ -5,7 +5,6 @@ #include "gpu.h" #include "gpu_backend.h" #include "gpu_dump.h" -#include "gpu_hw_texture_cache.h" #include "gpu_thread_commands.h" #include "interrupt_controller.h" #include "system.h" @@ -1048,12 +1047,6 @@ void GPU::FinishVRAMWrite() m_vram_transfer.height, sizeof(u16) * m_vram_transfer.width, m_blit_buffer.data(), true); } - if (GPUTextureCache::ShouldDumpVRAMWrite(m_vram_transfer.width, m_vram_transfer.height)) - { - GPUTextureCache::DumpVRAMWrite(m_vram_transfer.width, m_vram_transfer.height, - reinterpret_cast(m_blit_buffer.data())); - } - UpdateVRAM(m_vram_transfer.x, m_vram_transfer.y, m_vram_transfer.width, m_vram_transfer.height, m_blit_buffer.data(), m_GPUSTAT.set_mask_while_drawing, m_GPUSTAT.check_mask_before_draw); } diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 64c4a8d53..d4b2054ba 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -3243,6 +3243,10 @@ void GPU_HW::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data, b } else { + // no point dumping things we can't replace, so put it after the mask check + if (GPUTextureCache::ShouldDumpVRAMWrite(width, height)) + GPUTextureCache::DumpVRAMWrite(width, height, data); + GPUTexture* rtex = GPUTextureCache::GetVRAMReplacement(width, height, data); if (rtex && BlitVRAMReplacementTexture(rtex, x * m_resolution_scale, y * m_resolution_scale, width * m_resolution_scale, height * m_resolution_scale))