rend: read framebuffer as non-interlaced when possible

This commit is contained in:
Flyinghead 2020-12-16 14:40:11 +01:00
parent 190ab6690a
commit 3f1326a3ac
2 changed files with 18 additions and 1 deletions

View File

@ -91,6 +91,10 @@ void pvr_WriteReg(u32 paddr,u32 data)
rend_swap_frame(data);
break;
case FB_R_SOF2_addr:
data &= 0x00fffffc;
break;
case FB_W_SOF1_addr:
data &= 0x01fffffc;
rend_set_fb_write_addr(data);

View File

@ -769,7 +769,20 @@ void ReadFramebuffer(PixelBuffer<u32>& pb, int& width, int& height)
break;
}
u32 addr = SPG_CONTROL.interlace && !SPG_STATUS.fieldnum ? FB_R_SOF2 : FB_R_SOF1;
u32 addr = FB_R_SOF1;
if (SPG_CONTROL.interlace)
{
if (width == modulus && FB_R_SOF2 == FB_R_SOF1 + width * bpp)
{
// Typical case alternating even and odd lines -> take the whole buffer at once
modulus = 0;
height *= 2;
}
else
{
addr = SPG_STATUS.fieldnum ? FB_R_SOF2 : FB_R_SOF1;
}
}
pb.init(width, height);
u8 *dst = (u8*)pb.data();