Skip to content

Commit

Permalink
GS/HW: Improve detection of reverse texture shuffles
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Jul 30, 2023
1 parent 6180f12 commit 12e79cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,14 @@ void GSRendererHW::ConvertSpriteTextureShuffle(bool& write_ba, bool& read_ba)
const u32 count = m_vertex.next;
GSVertex* v = &m_vertex.buff[0];
const GIFRegXYOFFSET& o = m_context->XYOFFSET;

const GSVertex first_vert = (v[0].XYZ.X <= v[m_vertex.tail - 2].XYZ.X) ? v[0] : v[m_vertex.tail - 2];
// vertex position is 8 to 16 pixels, therefore it is the 16-31 bits of the colors
const int pos = (v[0].XYZ.X - o.OFX) & 0xFF;
const int pos = (first_vert.XYZ.X - o.OFX) & 0xFF;
write_ba = (pos > 112 && pos < 136);

// Read texture is 8 to 16 pixels (same as above)
const float tw = static_cast<float>(1u << m_cached_ctx.TEX0.TW);
int tex_pos = (PRIM->FST) ? v[0].U : static_cast<int>(tw * v[0].ST.S);
int tex_pos = (PRIM->FST) ? first_vert.U : static_cast<int>(tw * first_vert.ST.S);
tex_pos &= 0xFF;
read_ba = (tex_pos > 112 && tex_pos < 144);

Expand Down

0 comments on commit 12e79cc

Please sign in to comment.