Skip to content

Commit

Permalink
GS: Predivide ST by Q on large equal-Q triangles
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stenzek committed Apr 30, 2024
1 parent fd0c82c commit 40c7982
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<true>(&v[i].ST);
v_st = (v_st / v_q).insert32<2, 2>(v_st);
GSVector4::store<true>(&v[i].ST, v_st);
}
}
}
break;

Expand Down

0 comments on commit 40c7982

Please sign in to comment.