GPU/HW: Fix TC + SW-For-Readbacks combo

This commit is contained in:
Stenzek 2024-12-02 20:36:22 +10:00
parent ac79e43cc0
commit cbc22a89f7
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -25,6 +25,7 @@ public:
virtual ~GPUBackend(); virtual ~GPUBackend();
ALWAYS_INLINE const Threading::Thread* GetThread() const { return m_use_gpu_thread ? &m_gpu_thread : nullptr; } 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 bool Initialize(bool use_thread);
virtual void Reset(); virtual void Reset();

View File

@ -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); GL_SCOPE_FMT("FillVRAM({},{} => {},{} ({}x{}) with 0x{:08X}", x, y, x + width, y + height, width, height, color);
DeactivateROV(); 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(); GPUBackendFillVRAMCommand* cmd = m_sw_renderer->NewFillVRAMCommand();
FillBackendCommandParameters(cmd); 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); const GSVector4i bounds = GetVRAMTransferBounds(x, y, width, height);
// If TC is enabled, we have to update local memory. // If TC is enabled, we have to update local memory.
if (m_use_texture_cache && !IsInterlacedRenderingEnabled()) if (handle_with_tc)
{ {
AddWrittenRectangle(bounds); AddWrittenRectangle(bounds);
GPU_SW_Rasterizer::FillVRAM(x, y, width, height, color, false, 0); 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<s32>(VRAM_WIDTH) && bounds.bottom <= static_cast<s32>(VRAM_HEIGHT)); DebugAssert(bounds.right <= static_cast<s32>(VRAM_WIDTH) && bounds.bottom <= static_cast<s32>(VRAM_HEIGHT));
AddWrittenRectangle(bounds); AddWrittenRectangle(bounds);
if (m_sw_renderer) if (m_sw_renderer && m_sw_renderer->IsUsingThread())
{ {
const u32 num_words = width * height; const u32 num_words = width * height;
GPUBackendUpdateVRAMCommand* cmd = m_sw_renderer->NewUpdateVRAMCommand(num_words); GPUBackendUpdateVRAMCommand* cmd = m_sw_renderer->NewUpdateVRAMCommand(num_words);