diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index eb8ecdcde..6706df436 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -257,7 +257,8 @@ GPU_HW::BatchPrimitive GPU_HW::GetPrimitiveForCommand(RenderCommand rc) void GPU_HW::FillVRAM(u32 x, u32 y, u32 width, u32 height, u32 color) { - m_vram_dirty_rect.Include(Common::Rectangle::FromExtents(x, y, width, height).Clamped(0, 0, VRAM_WIDTH, VRAM_HEIGHT)); + m_vram_dirty_rect.Include( + Common::Rectangle::FromExtents(x, y, width, height).Clamped(0, 0, VRAM_WIDTH, VRAM_HEIGHT)); } void GPU_HW::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data) @@ -268,7 +269,8 @@ void GPU_HW::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data) void GPU_HW::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 width, u32 height) { - m_vram_dirty_rect.Include(Common::Rectangle::FromExtents(dst_x, dst_y, width, height).Clamped(0, 0, VRAM_WIDTH, VRAM_HEIGHT)); + m_vram_dirty_rect.Include( + Common::Rectangle::FromExtents(dst_x, dst_y, width, height).Clamped(0, 0, VRAM_WIDTH, VRAM_HEIGHT)); } void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32* command_ptr) @@ -288,6 +290,12 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32 FlushRender(); UpdateVRAMReadTexture(); + m_renderer_stats.num_vram_read_texture_updates++; + + // At this point, we're still drawing to the same area. Without knowing the polygon bounds, potentially the + // whole area can be drawn over in this call. So we have to keep that range dirty. This is not ideal, since + // we're going to be doing a bunch of potentially redundant copies. + m_vram_dirty_rect = m_drawing_area; } } diff --git a/src/core/gpu_hw_d3d11.cpp b/src/core/gpu_hw_d3d11.cpp index 1615d8d7e..48380a641 100644 --- a/src/core/gpu_hw_d3d11.cpp +++ b/src/core/gpu_hw_d3d11.cpp @@ -713,9 +713,6 @@ void GPU_HW_D3D11::UpdateVRAMReadTexture() const CD3D11_BOX src_box(scaled_rect.left, scaled_rect.top, 0, scaled_rect.right, scaled_rect.bottom, 1); m_context->CopySubresourceRegion(m_vram_read_texture, 0, scaled_rect.left, scaled_rect.top, 0, m_vram_texture, 0, &src_box); - - m_renderer_stats.num_vram_read_texture_updates++; - ClearVRAMDirtyRectangle(); } void GPU_HW_D3D11::FlushRender() diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 37d8d9d3a..fbc869abe 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -812,9 +812,6 @@ void GPU_HW_OpenGL::UpdateVRAMReadTexture() glEnable(GL_SCISSOR_TEST); m_vram_texture.BindFramebuffer(GL_FRAMEBUFFER); } - - m_renderer_stats.num_vram_read_texture_updates++; - ClearVRAMDirtyRectangle(); } void GPU_HW_OpenGL::FlushRender() diff --git a/src/core/gpu_hw_opengl_es.cpp b/src/core/gpu_hw_opengl_es.cpp index 592788755..d9160036e 100644 --- a/src/core/gpu_hw_opengl_es.cpp +++ b/src/core/gpu_hw_opengl_es.cpp @@ -634,9 +634,6 @@ void GPU_HW_OpenGL_ES::UpdateVRAMReadTexture() glEnable(GL_SCISSOR_TEST); m_vram_texture.BindFramebuffer(GL_FRAMEBUFFER); } - - m_renderer_stats.num_vram_read_texture_updates++; - ClearVRAMDirtyRectangle(); } void GPU_HW_OpenGL_ES::FlushRender()