GPU: Improvements to height calculations when interlaced

Fixes screen doubling with interlacing force disabled, as well as
incorrect cropping area when non-interleaved framebuffers are used.
This commit is contained in:
Connor McLaughlin 2020-06-02 20:34:33 +10:00
parent b91f8c151d
commit 3848276fa2
1 changed files with 6 additions and 3 deletions

View File

@ -497,7 +497,10 @@ void GPU::UpdateCRTCDisplayParameters()
} }
} }
const u8 height_shift = BoolToUInt8(m_GPUSTAT.vertical_interlace); // If force-progressive is enabled, we only double the height in 480i mode. This way non-interleaved 480i framebuffers
// won't be broken when displayed.
const u8 y_shift = BoolToUInt8(m_GPUSTAT.vertical_interlace && m_GPUSTAT.vertical_resolution);
const u8 height_shift = m_force_progressive_scan ? y_shift : BoolToUInt8(m_GPUSTAT.vertical_interlace);
// Determine screen size. // Determine screen size.
cs.display_width = (((cs.horizontal_active_end - cs.horizontal_active_start) / cs.dot_clock_divider) + 2u) & ~3u; cs.display_width = (((cs.horizontal_active_end - cs.horizontal_active_start) / cs.dot_clock_divider) + 2u) & ~3u;
@ -541,13 +544,13 @@ void GPU::UpdateCRTCDisplayParameters()
if (vertical_display_start >= cs.vertical_active_start) if (vertical_display_start >= cs.vertical_active_start)
{ {
cs.display_origin_top = (vertical_display_start - cs.vertical_active_start) << height_shift; cs.display_origin_top = (vertical_display_start - cs.vertical_active_start) << y_shift;
cs.display_vram_top = m_crtc_state.regs.Y; cs.display_vram_top = m_crtc_state.regs.Y;
} }
else else
{ {
cs.display_origin_top = 0; cs.display_origin_top = 0;
cs.display_vram_top = m_crtc_state.regs.Y + ((cs.vertical_active_start - vertical_display_start) << height_shift); cs.display_vram_top = m_crtc_state.regs.Y + ((cs.vertical_active_start - vertical_display_start) << y_shift);
} }
if (vertical_display_end <= cs.vertical_active_end) if (vertical_display_end <= cs.vertical_active_end)