Skip to content

Commit

Permalink
GPU/HW: Fix TC + SW-For-Readbacks combo
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Dec 2, 2024
1 parent ac79e43 commit cbc22a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/core/gpu_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class GPUBackend
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();
Expand Down
7 changes: 4 additions & 3 deletions src/core/gpu_hw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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));
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);
Expand Down

0 comments on commit cbc22a8

Please sign in to comment.