From cf985f40eb9e6a4b8fcb151af36a2c81c219b57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 24 Jul 2022 11:56:10 +0200 Subject: [PATCH] Code cleanup --- GPU/Common/FramebufferManagerCommon.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index fd8e344dac11..1fef90686be6 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -271,10 +271,6 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame const u32 new_bpp = params.fmt == GE_FORMAT_8888 ? 4 : 2; - if (params.fb_address == 0x04165000) { - vfbFormatChanged = false; - } - // Find a matching framebuffer VirtualFramebuffer *vfb = nullptr; for (size_t i = 0; i < vfbs_.size(); ++i) { @@ -282,9 +278,6 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame const u32 bpp = v->format == GE_FORMAT_8888 ? 4 : 2; - u32 v_fb_first_line_end_ptr = v->fb_address + v->fb_stride * new_bpp; - u32 v_fb_end_ptr = v->fb_address + v->fb_stride * v->height * new_bpp; - if (v->fb_address == params.fb_address) { vfb = v; // Update fb stride in case it changed @@ -315,6 +308,9 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame } break; } else if (v->fb_stride == params.fb_stride && v->format == params.fmt) { + u32 v_fb_first_line_end_ptr = v->fb_address + v->fb_stride * new_bpp; + u32 v_fb_end_ptr = v->fb_address + v->fb_stride * v->height * new_bpp; + if (params.fb_address > v->fb_address && params.fb_address < v_fb_first_line_end_ptr) { const int x_offset = (params.fb_address - v->fb_address) / bpp; if (x_offset < params.fb_stride && v->height >= drawing_height) { @@ -338,8 +334,10 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame drawing_height += y_offset; break; } + } else { + // We ignore this match. + // TODO: We can allow X/Y overlaps too, but haven't seen any so safer to not. } - // TODO: We can allow X/Y overlaps too, but haven't seen any so safer to not. } }