GS:SW: Only run zclamp once

Also fixes clamping in the wrong spot in the C SW rasterizer
This commit is contained in:
TellowKrinkle authored and tellowkrinkle committed 2022-05-03 21:47:57 -05:00
1 parent 73c9279907
commit 2fa8f09a21
2 files changed
+6 -17

No files matched your search

+4 -7
View File
@@ -479,6 +479,9 @@ void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertex
{
zs = VectorI(z);
}
if (sel.zclamp)
zs = zs.min_u32(VectorI::xffffffff().srl32(sel.zpsm * 8));
}
else
{
@@ -505,15 +508,12 @@ void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertex
VectorI zso = zs;
VectorI zdo = zd;
if (sel.zoverflow || sel.zpsm == 0)
if (sel.zpsm == 0)
{
zso -= VectorI::x80000000();
zdo -= VectorI::x80000000();
}
if (sel.zclamp)
zso = zso.min_u32(VectorI::xffffffff().srl32(sel.zpsm * 8));
switch (sel.ztst)
{
case ZTST_GEQUAL: test |= zso < zdo; break;
@@ -1201,9 +1201,6 @@ void GSDrawScanline::CDrawScanline(int pixels, int left, int top, const GSVertex
zs = zs.blend8(zd, zm);
}
if (sel.zclamp)
zs = zs.min_u32(VectorI::xffffffff().srl32(sel.zpsm * 8));
bool fast = sel.ztest ? sel.zpsm < 2 : sel.zpsm == 0 && sel.notest;
if (sel.notest)
@@ -1089,6 +1089,7 @@ void GSDrawScanlineCodeGenerator2::TestZ(const XYm& temp1, const XYm& temp2)
cvttps2dq(xym0, z);
}
// Clamp Z to ZPSM_FMT_MAX
if (m_sel.zclamp)
{
const u8 amt = (u8)((m_sel.zpsm & 0x3) * 8);
@@ -1124,7 +1125,7 @@ void GSDrawScanlineCodeGenerator2::TestZ(const XYm& temp1, const XYm& temp2)
psrld(temp2, static_cast<u8>(m_sel.zpsm * 8));
}
if (m_sel.zoverflow || m_sel.zpsm == 0)
if (m_sel.zpsm == 0)
{
// GSVector4i o = GSVector4i::x80000000();
@@ -2552,15 +2553,6 @@ void GSDrawScanlineCodeGenerator2::WriteZBuf()
}
}
// Clamp Z to ZPSM_FMT_MAX
if (m_sel.zclamp)
{
const u8 amt = (u8)((m_sel.zpsm & 0x3) * 8);
pcmpeqd(xym7, xym7);
psrld(xym7, amt);
pminsd(xym1, xym7);
}
bool fast = m_sel.ztest ? m_sel.zpsm < 2 : m_sel.zpsm == 0 && m_sel.notest;
#if USING_XMM