From cbc22a89f78456421d18ea25808b335b53bf3eb6 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 2 Dec 2024 20:36:22 +1000 Subject: [PATCH] GPU/HW: Fix TC + SW-For-Readbacks combo --- src/core/gpu_backend.h | 1 + src/core/gpu_hw.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/gpu_backend.h b/src/core/gpu_backend.h index ea25a36a1..be9701f95 100644 --- a/src/core/gpu_backend.h +++ b/src/core/gpu_backend.h @@ -25,6 +25,7 @@ public: virtual ~GPUBackend(); ALWAYS_INLINE const Threading::Thread* GetThread() const { return m_use_gpu_thread ? &m_gpu_thread : nullptr; } + ALWAYS_INLINE bool IsUsingThread() const { return m_use_gpu_thread; } virtual bool Initialize(bool use_thread); virtual void Reset(); diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 2707a197a..7b561383e 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -3199,7 +3199,8 @@ void GPU_HW::FillVRAM(u32 x, u32 y, u32 width, u32 height, u32 color) GL_SCOPE_FMT("FillVRAM({},{} => {},{} ({}x{}) with 0x{:08X}", x, y, x + width, y + height, width, height, color); DeactivateROV(); - if (m_sw_renderer) + const bool handle_with_tc = (m_use_texture_cache && !IsInterlacedRenderingEnabled()); + if (m_sw_renderer && !handle_with_tc) { GPUBackendFillVRAMCommand* cmd = m_sw_renderer->NewFillVRAMCommand(); FillBackendCommandParameters(cmd); @@ -3216,7 +3217,7 @@ void GPU_HW::FillVRAM(u32 x, u32 y, u32 width, u32 height, u32 color) const GSVector4i bounds = GetVRAMTransferBounds(x, y, width, height); // If TC is enabled, we have to update local memory. - if (m_use_texture_cache && !IsInterlacedRenderingEnabled()) + if (handle_with_tc) { AddWrittenRectangle(bounds); GPU_SW_Rasterizer::FillVRAM(x, y, width, height, color, false, 0); @@ -3328,7 +3329,7 @@ void GPU_HW::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data, b DebugAssert(bounds.right <= static_cast(VRAM_WIDTH) && bounds.bottom <= static_cast(VRAM_HEIGHT)); AddWrittenRectangle(bounds); - if (m_sw_renderer) + if (m_sw_renderer && m_sw_renderer->IsUsingThread()) { const u32 num_words = width * height; GPUBackendUpdateVRAMCommand* cmd = m_sw_renderer->NewUpdateVRAMCommand(num_words);