mirror of https://github.com/PCSX2/pcsx2.git
Update GSSetupPrimCodeGenerator for x86_64.
offsetof requires the expression to be constant to get the offset. Use a combination of offsetof + sizeof to get the correct offset.
This commit is contained in:
parent
74dd2553a6
commit
8ff0f9e869
|
@ -36,7 +36,7 @@ void GSSetupPrimCodeGenerator::Generate()
|
||||||
|
|
||||||
mov(r8, (size_t)&m_local);
|
mov(r8, (size_t)&m_local);
|
||||||
|
|
||||||
if((m_en.z || m_en.f) && !m_sel.sprite || m_en.t || m_en.c && m_sel.iip)
|
if((m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS || m_en.t || m_en.c && m_sel.iip)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 5; i++)
|
for(int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ void GSSetupPrimCodeGenerator::Depth()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_sel.sprite)
|
if(m_sel.prim != GS_SPRITE_CLASS)
|
||||||
{
|
{
|
||||||
// GSVector4 p = dscan.p;
|
// GSVector4 p = dscan.p;
|
||||||
|
|
||||||
|
@ -96,7 +96,9 @@ void GSSetupPrimCodeGenerator::Depth()
|
||||||
cvttps2dq(xmm2, xmm2);
|
cvttps2dq(xmm2, xmm2);
|
||||||
pshuflw(xmm2, xmm2, _MM_SHUFFLE(2, 2, 0, 0));
|
pshuflw(xmm2, xmm2, _MM_SHUFFLE(2, 2, 0, 0));
|
||||||
pshufhw(xmm2, xmm2, _MM_SHUFFLE(2, 2, 0, 0));
|
pshufhw(xmm2, xmm2, _MM_SHUFFLE(2, 2, 0, 0));
|
||||||
movdqa(ptr[r8 + offsetof(GSScanlineLocalData, d[i].f)], xmm2);
|
|
||||||
|
const size_t variableOffset = offsetof(GSScanlineLocalData, d[0].f) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
movdqa(ptr[r8 + variableOffset], xmm2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +120,9 @@ void GSSetupPrimCodeGenerator::Depth()
|
||||||
|
|
||||||
movaps(xmm1, xmm0);
|
movaps(xmm1, xmm0);
|
||||||
mulps(xmm1, Xmm(4 + i));
|
mulps(xmm1, Xmm(4 + i));
|
||||||
movdqa(ptr[r8 + offsetof(GSScanlineLocalData, d[i].z)], xmm1);
|
|
||||||
|
const size_t variableOffset = offsetof(GSScanlineLocalData, d[0].z) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
movdqa(ptr[r8 + variableOffset], xmm1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,21 +230,28 @@ void GSSetupPrimCodeGenerator::Texture()
|
||||||
|
|
||||||
cvttps2dq(xmm2, xmm2);
|
cvttps2dq(xmm2, xmm2);
|
||||||
|
|
||||||
|
const size_t variableOffsetS = offsetof(GSScanlineLocalData, d[0].s) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
const size_t variableOffsetT = offsetof(GSScanlineLocalData, d[0].t) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
|
||||||
switch(j)
|
switch(j)
|
||||||
{
|
{
|
||||||
case 0: movdqa(ptr[r8 + offsetof(GSScanlineLocalData, d[i].si)], xmm2); break;
|
case 0: movdqa(ptr[r8 + variableOffsetS], xmm2); break;
|
||||||
case 1: movdqa(ptr[r8 + offsetof(GSScanlineLocalData, d[i].ti)], xmm2); break;
|
case 1: movdqa(ptr[r8 + variableOffsetT], xmm2); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// m_local.d[i].s/t/q = v;
|
// m_local.d[i].s/t/q = v;
|
||||||
|
|
||||||
|
const size_t variableOffsetS = offsetof(GSScanlineLocalData, d[0].s) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
const size_t variableOffsetT = offsetof(GSScanlineLocalData, d[0].t) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
const size_t variableOffsetQ = offsetof(GSScanlineLocalData, d[0].q) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
|
||||||
switch(j)
|
switch(j)
|
||||||
{
|
{
|
||||||
case 0: movaps(ptr[r8 + offsetof(GSScanlineLocalData, d[i].s)], xmm2); break;
|
case 0: movaps(ptr[r8 + variableOffsetS], xmm2); break;
|
||||||
case 1: movaps(ptr[r8 + offsetof(GSScanlineLocalData, d[i].t)], xmm2); break;
|
case 1: movaps(ptr[r8 + variableOffsetT], xmm2); break;
|
||||||
case 2: movaps(ptr[r8 + offsetof(GSScanlineLocalData, d[i].q)], xmm2); break;
|
case 2: movaps(ptr[r8 + variableOffsetQ], xmm2); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +308,9 @@ void GSSetupPrimCodeGenerator::Color()
|
||||||
// m_local.d[i].rb = r.upl16(b);
|
// m_local.d[i].rb = r.upl16(b);
|
||||||
|
|
||||||
punpcklwd(xmm2, xmm3);
|
punpcklwd(xmm2, xmm3);
|
||||||
movdqa(ptr[r8 + offsetof(GSScanlineLocalData, d[i].rb)], xmm2);
|
|
||||||
|
const size_t variableOffset = offsetof(GSScanlineLocalData, d[0].rb) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
movdqa(ptr[r8 + variableOffset], xmm2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GSVector4 c = dscan.c;
|
// GSVector4 c = dscan.c;
|
||||||
|
@ -330,7 +343,9 @@ void GSSetupPrimCodeGenerator::Color()
|
||||||
// m_local.d[i].ga = g.upl16(a);
|
// m_local.d[i].ga = g.upl16(a);
|
||||||
|
|
||||||
punpcklwd(xmm2, xmm3);
|
punpcklwd(xmm2, xmm3);
|
||||||
movdqa(ptr[r8 + offsetof(GSScanlineLocalData, d[i].ga)], xmm2);
|
|
||||||
|
const size_t variableOffset = offsetof(GSScanlineLocalData, d[0].ga) + (i * sizeof(GSScanlineLocalData::d[0]));
|
||||||
|
movdqa(ptr[r8 + variableOffset], xmm2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -362,4 +377,4 @@ void GSSetupPrimCodeGenerator::Color()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue