GS/HW: Improve detection of reverse texture shuffles

This commit is contained in:
refractionpcsx2 2023-07-29 22:03:29 +01:00
parent 6180f12ba3
commit 12e79cccf6
1 changed files with 3 additions and 3 deletions

View File

@ -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);