From 6bacbf3438c87f0726c81a40b2f5f5f0d13b670f Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 28 Feb 2020 23:01:38 +1000 Subject: [PATCH] GPU: Fix 480i displays getting cut off in OpenGL and Software --- src/core/gpu_hw_opengl.cpp | 3 ++- src/core/gpu_hw_opengl_es.cpp | 3 ++- src/core/gpu_sw.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 694bda534..4c4cc3d9c 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -490,7 +490,8 @@ void GPU_HW_OpenGL::UpdateDisplay() const u32 scaled_vram_offset_x = vram_offset_x * m_resolution_scale; const u32 scaled_vram_offset_y = vram_offset_y * m_resolution_scale; const u32 display_width = std::min(m_crtc_state.active_display_width, VRAM_WIDTH - vram_offset_x); - const u32 display_height = std::min(m_crtc_state.active_display_height, VRAM_HEIGHT - vram_offset_y); + const u32 display_height = std::min(m_crtc_state.active_display_height << BoolToUInt8(m_GPUSTAT.In480iMode()), + VRAM_HEIGHT - vram_offset_y); const u32 scaled_display_width = display_width * m_resolution_scale; const u32 scaled_display_height = display_height * m_resolution_scale; const bool interlaced = IsDisplayInterlaced(); diff --git a/src/core/gpu_hw_opengl_es.cpp b/src/core/gpu_hw_opengl_es.cpp index 80853a4cf..2ae57b8fd 100644 --- a/src/core/gpu_hw_opengl_es.cpp +++ b/src/core/gpu_hw_opengl_es.cpp @@ -357,7 +357,8 @@ void GPU_HW_OpenGL_ES::UpdateDisplay() const u32 scaled_vram_offset_x = vram_offset_x * m_resolution_scale; const u32 scaled_vram_offset_y = vram_offset_y * m_resolution_scale; const u32 display_width = std::min(m_crtc_state.active_display_width, VRAM_WIDTH - vram_offset_x); - const u32 display_height = std::min(m_crtc_state.active_display_height, VRAM_HEIGHT - vram_offset_y); + const u32 display_height = std::min(m_crtc_state.active_display_height << BoolToUInt8(m_GPUSTAT.In480iMode()), + VRAM_HEIGHT - vram_offset_y); const u32 scaled_display_width = display_width * m_resolution_scale; const u32 scaled_display_height = display_height * m_resolution_scale; const bool interlaced = IsDisplayInterlaced(); diff --git a/src/core/gpu_sw.cpp b/src/core/gpu_sw.cpp index 959bceabb..d2dc9dbb6 100644 --- a/src/core/gpu_sw.cpp +++ b/src/core/gpu_sw.cpp @@ -120,7 +120,8 @@ void GPU_SW::UpdateDisplay() const u32 vram_offset_x = m_crtc_state.regs.X; const u32 vram_offset_y = m_crtc_state.regs.Y; const u32 display_width = std::min(m_crtc_state.active_display_width, VRAM_WIDTH - vram_offset_x); - const u32 display_height = std::min(m_crtc_state.active_display_height, VRAM_HEIGHT - vram_offset_y); + const u32 display_height = std::min(m_crtc_state.active_display_height << BoolToUInt8(m_GPUSTAT.In480iMode()), + VRAM_HEIGHT - vram_offset_y); if (m_GPUSTAT.display_disable) { @@ -601,9 +602,9 @@ void GPU_SW::ShadePixel(u32 x, u32 y, u8 color_r, u8 color_g, u8 color_b, u8 tex UNREFERENCED_VARIABLE(transparent); } - const u16 mask_and = m_GPUSTAT.GetMaskAND(); - if ((bg_color.bits & mask_and) != mask_and) - return; + const u16 mask_and = m_GPUSTAT.GetMaskAND(); + if ((bg_color.bits & mask_and) != mask_and) + return; SetPixel(static_cast(x), static_cast(y), color.bits | m_GPUSTAT.GetMaskOR()); }