From e2b1158514f5238ff2ed4016b40173204e43f77c Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Fri, 3 Jul 2020 22:11:05 -0700 Subject: [PATCH 1/3] GPU: Report CRTC padding as signed in debug window --- src/core/gpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index fe593d2a6..7fed2d436 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -1448,7 +1448,7 @@ void GPU::DrawDebugStateWindow() ImGui::Text("Display origin: %u, %u", cs.display_origin_left, cs.display_origin_top); ImGui::Text("Active display: %ux%u @ (%u, %u)", cs.display_vram_width, cs.display_vram_height, cs.display_vram_left, cs.display_vram_top); - ImGui::Text("Padding: Left=%u, Top=%u, Right=%u, Bottom=%u", cs.display_origin_left, cs.display_origin_top, + ImGui::Text("Padding: Left=%d, Top=%d, Right=%d, Bottom=%d", cs.display_origin_left, cs.display_origin_top, cs.display_width - cs.display_vram_width - cs.display_origin_left, cs.display_height - cs.display_vram_height - cs.display_origin_top); } From 000a51298a8631654e92272a5643240d0b53667f Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Sat, 4 Jul 2020 17:55:43 -0700 Subject: [PATCH 2/3] GPU: Don't round screen size to 4-pixel multiple --- src/core/gpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 7fed2d436..0ff451064 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -578,7 +578,7 @@ void GPU::UpdateCRTCDisplayParameters() const u8 height_shift = m_force_progressive_scan ? y_shift : BoolToUInt8(m_GPUSTAT.vertical_interlace); // 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; cs.display_height = (cs.vertical_active_end - cs.vertical_active_start) << height_shift; // Determine if we need to adjust the VRAM rectangle (because the display is starting outside the visible area) or add From e42d5fed75dfd7affb48299f86b12610e9280672 Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Sat, 4 Jul 2020 17:59:14 -0700 Subject: [PATCH 3/3] GPU: Adjust 4-pixel boundary alignment formula Fixes missing edge in Tenchi wo Kurau II: Sekiheki no Tatakai. --- src/core/gpu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 0ff451064..6c4bd284a 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -612,7 +612,8 @@ void GPU::UpdateCRTCDisplayParameters() } // align to 4-pixel boundary - cs.display_vram_width = ((horizontal_active_ticks / cs.dot_clock_divider) + 2u) & ~3u; + cs.display_vram_width = + (static_cast(std::round(horizontal_active_ticks / static_cast(cs.dot_clock_divider))) + 2u) & ~3u; // apply the crop from the start (usually overscan) cs.display_vram_width -= std::min(cs.display_vram_width, horizontal_skip_pixels);