From 222fad315d47181a97545d5836096a1300aac3ec Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 29 Aug 2023 23:29:50 +0100 Subject: [PATCH] GS/HW: Allow reverse primitive gap checking --- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index 8d104ecf75..0567c44f05 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -6166,11 +6166,24 @@ bool GSRendererHW::PrimitiveCoversWithoutGaps() u32 last_pX = v[1].XYZ.X; for (u32 i = 2; i < m_vertex.next; i += 2) { - const u32 dpX = v[i + 1].XYZ.X - v[i].XYZ.X; - if (dpX != first_dpX || v[i].XYZ.X != last_pX) + if (v[i].XYZ.X < v[i-2].XYZ.X) { - m_primitive_covers_without_gaps = false; - return false; + const u32 dpX = v[i + 1].XYZ.X - v[i].XYZ.X; + const u32 prev_X = v[i - 2].XYZ.X - m_context->XYOFFSET.OFX; + if (dpX != prev_X || v[i].XYZ.X != m_context->XYOFFSET.OFX) + { + m_primitive_covers_without_gaps = false; + return false; + } + } + else + { + const u32 dpX = v[i + 1].XYZ.X - v[i].XYZ.X; + if (dpX != first_dpX || v[i].XYZ.X != last_pX) + { + m_primitive_covers_without_gaps = false; + return false; + } } last_pX = v[i + 1].XYZ.X;