Completely remove the code instead of commenting it out, seems to cause
issues with several games.
This commit is contained in:
lightningterror 2021-10-08 18:35:21 +02:00 committed by Kojin
parent ef2c7ac480
commit 6ed00107cf
1 changed files with 0 additions and 104 deletions

View File

@ -2991,110 +2991,6 @@ void GSState::GetTextureMinMax(GSVector4i& r, const GIFRegTEX0& TEX0, const GIFR
__assume(0);
}
if (wms != CLAMP_REGION_REPEAT || wmt != CLAMP_REGION_REPEAT)
{
GSVector4 st = m_vt.m_min.t.xyxy(m_vt.m_max.t);
if (linear)
{
st += GSVector4(-0.5f, 0.5f).xxyy();
}
GSVector4i uv = GSVector4i(st.floor());
GSVector4i u, v;
int mask = 0;
// See commented code below for the meaning of mask
if (wms == CLAMP_REPEAT || wmt == CLAMP_REPEAT)
{
u = uv & GSVector4i::xffffffff().srl32(32 - tw);
v = uv & GSVector4i::xffffffff().srl32(32 - th);
GSVector4i uu = uv.sra32(tw);
GSVector4i vv = uv.sra32(th);
mask = (uu.upl32(vv) == uu.uph32(vv)).mask();
}
uv = uv.rintersect(tr);
switch (wms)
{
case CLAMP_REPEAT:
// This commented code cannot be used directly because it needs uv before the intersection
//if (uv_.x >> tw == uv_.z >> tw)
//{
// vr.x = std::max(vr.x, (uv_.x & ((1 << tw) - 1)));
// vr.z = std::min(vr.z, (uv_.z & ((1 << tw) - 1)) + 1);
//}
if (mask & 0x000f)
{
if (vr.x < u.x)
vr.x = u.x;
if (vr.z > u.z + 1)
vr.z = u.z + 1;
}
break;
case CLAMP_CLAMP:
case CLAMP_REGION_CLAMP:
if (vr.x > uv.z)
vr.z = vr.x + 1;
else if (vr.z < uv.x)
vr.x = vr.z - 1;
else
{
if (vr.x < uv.x)
vr.x = uv.x;
if (vr.z > uv.z + 1)
vr.z = uv.z + 1;
}
break;
case CLAMP_REGION_REPEAT:
break;
default:
__assume(0);
}
switch (wmt)
{
case CLAMP_REPEAT:
//if (uv_.y >> th == uv_.w >> th)
//{
// vr.y = max(vr.y, (uv_.y & ((1 << th) - 1)));
// vr.w = min(vr.w, (uv_.w & ((1 << th) - 1)) + 1);
//}
if (mask & 0xf000)
{
if (vr.y < v.y)
vr.y = v.y;
if (vr.w > v.w + 1)
vr.w = v.w + 1;
}
break;
case CLAMP_CLAMP:
case CLAMP_REGION_CLAMP:
if (vr.y > uv.w)
vr.w = vr.y + 1;
else if (vr.w < uv.y)
vr.y = vr.w - 1;
else
{
if (vr.y < uv.y)
vr.y = uv.y;
if (vr.w > uv.w + 1)
vr.w = uv.w + 1;
}
break;
case CLAMP_REGION_REPEAT:
break;
default:
__assume(0);
}
}
vr = vr.rintersect(tr);
// This really shouldn't happen now except with the clamping region set entirely outside the texture,