From 40c7982dcfa09f1813357802de04661b18f2dd62 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 30 Apr 2024 01:39:20 +1000 Subject: [PATCH] GS: Predivide ST by Q on large equal-Q triangles In addition to sprites. Fixes intro screen of IndyCar Series, which uses rotated sprites (tris). Fixes some onscreen sprites in SpongeBob SquarePants - Revenge of the Flying Dutchman. Fixes menu background in Cold Winter. Fixes health bars in Biker Mice From Mars. --- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index 1047703b3a..44de15b23f 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -3423,6 +3423,20 @@ void GSRendererHW::SetupIA(float target_scale, float sx, float sy) { m_conf.topology = GSHWDrawConfig::Topology::Triangle; m_conf.indices_per_prim = 3; + + // See note above in GS_SPRITE_CLASS. + if (m_vt.m_accurate_stq && m_vt.m_eq.stq) [[unlikely]] + { + GSVertex* const v = m_vertex.buff; + const GSVector4 v_q = GSVector4(v[0].RGBAQ.Q); + for (u32 i = 0; i < m_vertex.next; i++) + { + // v[i].ST.ST /= v[i].RGBAQ.Q; v[i].RGBAQ.Q = 1.0f; (Q / Q = 1) + GSVector4 v_st = GSVector4::load(&v[i].ST); + v_st = (v_st / v_q).insert32<2, 2>(v_st); + GSVector4::store(&v[i].ST, v_st); + } + } } break;