Readback: Only scale a framebuffer down when it's rendered above maxScaleFactor

ReadFramebufferForDebug scaled the buffer down, cropped to its drawn size,
whenever the render width was more than the drawn width times maxScaleFactor.
At 1x that's any buffer wider than what has been drawn in it, though nothing
needs scaling.

Headless compares at maxScaleFactor 1, so this cut off most of the screen in
Gangs of London, which draws a 256 px wide region: its dumps went from 78 to
62,017 pixels differing from the PSP.

Now it only scales down when the render scale is above maxScaleFactor, and
then scales the whole buffer, since a display at an offset can sit past the
drawn width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-09 16:22:05 +02:00
1 parent 06fbbf1218
commit ed7de3ea76
1 file changed
+5 -6
+5 -6
View File
@@ -3169,20 +3169,19 @@ bool FramebufferManagerCommon::ReadFramebufferForDebug(VirtualFramebuffer *vfb,
Draw::Framebuffer *bound = nullptr;
if (vfb->fbo) {
if (maxScaleFactor > 0 && vfb->renderWidth > vfb->width * maxScaleFactor) {
w = vfb->width * maxScaleFactor;
h = vfb->height * maxScaleFactor;
// Scale down the whole buffer: the crop below may be anywhere in it, past the drawn width (a display at an offset).
if (maxScaleFactor > 0 && vfb->renderScaleFactor > maxScaleFactor) {
w = vfb->bufferWidth * maxScaleFactor;
h = vfb->bufferHeight * maxScaleFactor;
scale = maxScaleFactor;
Draw::Framebuffer *tempFBO = GetTempFBO(TempFBO::COPY, w, h);
VirtualFramebuffer tempVfb = *vfb;
tempVfb.fbo = tempFBO;
tempVfb.bufferWidth = vfb->width;
tempVfb.bufferHeight = vfb->height;
tempVfb.renderWidth = w;
tempVfb.renderHeight = h;
tempVfb.renderScaleFactor = maxScaleFactor;
BlitFramebuffer(&tempVfb, 0, 0, vfb, 0, 0, vfb->width, vfb->height, 0, RASTER_COLOR, "Blit_GetFramebuffer");
BlitFramebuffer(&tempVfb, 0, 0, vfb, 0, 0, vfb->bufferWidth, vfb->bufferHeight, 0, RASTER_COLOR, "Blit_GetFramebuffer");
bound = tempFBO;
} else {