@@ -4003,7 +4003,6 @@ __forceinline bool GSState::EarlyDetectShuffle(u32 prim)
40034003
40044004 const GSVertex* RESTRICT vertex = &m_vertex.buff [0 ];
40054005 const u16 * RESTRICT index = &m_index.buff [0 ];
4006- const GSVector4i& o = m_xyof;
40074006
40084007 if (GSLocalMemory::m_psm[m_context->FRAME .PSM ].bpp == 16 && GSLocalMemory::m_psm[m_context->TEX0 .PSM ].bpp == 16 )
40094008 {
@@ -4023,6 +4022,7 @@ __forceinline bool GSState::EarlyDetectShuffle(u32 prim)
40234022 {
40244023 const float q0 = vertex[index[0 ]].RGBAQ .Q == 0 .0f ? FLT_MIN : vertex[index[0 ]].RGBAQ .Q ;
40254024 u0 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[0 ]].ST .S / q0) * 16 .0f );
4025+
40264026 const float qn = m_v.RGBAQ .Q == 0 .0f ? FLT_MIN : m_v.RGBAQ .Q ;
40274027 un = static_cast <int >((1 << m_context->TEX0 .TW ) * (m_v.ST .S / qn) * 16 .0f );
40284028 }
@@ -4044,6 +4044,7 @@ __forceinline bool GSState::EarlyDetectShuffle(u32 prim)
40444044
40454045 const int x0 = static_cast <int >(vertex[index[0 ]].XYZ .X ) - static_cast <int >(m_context->XYOFFSET .OFX );
40464046 const int y0 = static_cast <int >(vertex[index[0 ]].XYZ .Y ) - static_cast <int >(m_context->XYOFFSET .OFY );
4047+
40474048 const int x1 = static_cast <int >(vertex[index[1 ]].XYZ .X ) - static_cast <int >(m_context->XYOFFSET .OFX );
40484049 const int y1 = static_cast <int >(vertex[index[1 ]].XYZ .Y ) - static_cast <int >(m_context->XYOFFSET .OFY );
40494050
@@ -4053,17 +4054,20 @@ __forceinline bool GSState::EarlyDetectShuffle(u32 prim)
40534054 {
40544055 u0 = static_cast <int >(vertex[index[0 ]].U );
40554056 v0 = static_cast <int >(vertex[index[0 ]].V );
4057+
40564058 u1 = static_cast <int >(vertex[index[1 ]].U );
40574059 v1 = static_cast <int >(vertex[index[1 ]].V );
40584060 }
40594061 else
40604062 {
4061- const float q0 = vertex[index[0 ]].RGBAQ .Q == 0 .0f ? FLT_MIN : vertex[index[0 ]].RGBAQ .Q ;
4062- u0 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[0 ]].ST .S / q0) * 16 .0f );
4063- v0 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[0 ]].ST .T / q0) * 16 .0f );
4063+ // Sprites have constant Q so use the second.
40644064 const float q1 = vertex[index[1 ]].RGBAQ .Q == 0 .0f ? FLT_MIN : vertex[index[1 ]].RGBAQ .Q ;
4065- u1 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[1 ]].ST .S / q0) * 16 .0f );
4066- v1 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[1 ]].ST .T / q0) * 16 .0f );
4065+
4066+ u0 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[0 ]].ST .S / q1) * 16 .0f );
4067+ v0 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[0 ]].ST .T / q1) * 16 .0f );
4068+
4069+ u1 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[1 ]].ST .S / q1) * 16 .0f );
4070+ v1 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[1 ]].ST .T / q1) * 16 .0f );
40674071 }
40684072
40694073 // Check that the source and destination sprite are exactly 8 pixel squares.
@@ -4093,6 +4097,7 @@ __forceinline bool GSState::EarlyDetectShuffle(u32 prim)
40934097
40944098 const int x0 = static_cast <int >(vertex[index[0 ]].XYZ .X ) - static_cast <int >(m_context->XYOFFSET .OFX );
40954099 const int y0 = static_cast <int >(vertex[index[0 ]].XYZ .Y ) - static_cast <int >(m_context->XYOFFSET .OFY );
4100+
40964101 const int x1 = static_cast <int >(vertex[index[1 ]].XYZ .X ) - static_cast <int >(m_context->XYOFFSET .OFX );
40974102 const int y1 = static_cast <int >(vertex[index[1 ]].XYZ .Y ) - static_cast <int >(m_context->XYOFFSET .OFY );
40984103
@@ -4102,17 +4107,20 @@ __forceinline bool GSState::EarlyDetectShuffle(u32 prim)
41024107 {
41034108 u0 = static_cast <int >(vertex[index[0 ]].U );
41044109 v0 = static_cast <int >(vertex[index[0 ]].V );
4110+
41054111 u1 = static_cast <int >(vertex[index[1 ]].U );
41064112 v1 = static_cast <int >(vertex[index[1 ]].V );
41074113 }
41084114 else
41094115 {
4110- const float q0 = vertex[index[0 ]].RGBAQ .Q == 0 .0f ? FLT_MIN : vertex[index[0 ]].RGBAQ .Q ;
4111- u0 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[0 ]].ST .S / q0) * 16 .0f );
4112- v0 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[0 ]].ST .T / q0) * 16 .0f );
4116+ // Sprites have constant Q so use the second.
41134117 const float q1 = vertex[index[1 ]].RGBAQ .Q == 0 .0f ? FLT_MIN : vertex[index[1 ]].RGBAQ .Q ;
4114- u1 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[1 ]].ST .S / q0) * 16 .0f );
4115- v1 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[1 ]].ST .T / q0) * 16 .0f );
4118+
4119+ u0 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[0 ]].ST .S / q1) * 16 .0f );
4120+ v0 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[0 ]].ST .T / q1) * 16 .0f );
4121+
4122+ u1 = static_cast <int >((1 << m_context->TEX0 .TW ) * (vertex[index[1 ]].ST .S / q1) * 16 .0f );
4123+ v1 = static_cast <int >((1 << m_context->TEX0 .TH ) * (vertex[index[1 ]].ST .T / q1) * 16 .0f );
41164124 }
41174125
41184126 // Check that the source and destination sprite are exactly 8 pixel squares.
0 commit comments