From 219e890da588f2043310609063922248b3b9a31f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 14 Oct 2024 18:20:47 +1000 Subject: [PATCH] GPU/HW: Write through VRAM transfers Reduces the chances of rendering nothing after device loss. --- src/core/gpu_hw.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index c0f0f6150..ffcf15474 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -3296,12 +3296,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); - // We want to dump *before* the write goes through, otherwise we dump bad data. - if (m_use_texture_cache) - { - GPUTextureCache::WriteVRAM(x, y, width, height, data, set_mask, check_mask, bounds); - } - else if (m_sw_renderer) + if (m_sw_renderer) { const u32 num_words = width * height; GPUBackendUpdateVRAMCommand* cmd = m_sw_renderer->NewUpdateVRAMCommand(num_words); @@ -3315,6 +3310,10 @@ void GPU_HW::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data, b std::memcpy(cmd->data, data, sizeof(u16) * num_words); m_sw_renderer->PushCommand(cmd); } + else + { + GPUTextureCache::WriteVRAM(x, y, width, height, data, set_mask, check_mask, bounds); + } if (check_mask) {