GS/HW: Allow bilinear from colour backed Z formats

Fixes the haze effect in GTA: San Andreas from being extra blurry.
Improves shadows in Everybody's Golf and Tennis.
This commit is contained in:
Stenzek 2023-10-11 21:47:30 +10:00 committed by Connor McLaughlin
parent b09240702e
commit 99554f5622
1 changed files with 4 additions and 12 deletions

View File

@ -4210,10 +4210,10 @@ __ri void GSRendererHW::EmulateTextureSampler(const GSTextureCache::Target* rt,
m_conf.ps.wms = (wms & 2 || target_region) ? wms : 0;
m_conf.ps.wmt = (wmt & 2 || target_region) ? wmt : 0;
// Depth + bilinear filtering isn't done yet (And I'm not sure we need it anyway but a game will prove me wrong)
// So of course, GTA set the linear mode, but sampling is done at texel center so it is equivalent to nearest sampling
// Depth + bilinear filtering isn't done yet. But if the game has just set a Z24 swizzle on a colour texture, we can
// just pretend it's not a depth format, since in the texture cache, it's not.
// Other games worth testing: Area 51, Burnout
if (psm.depth && m_vt.IsLinear())
if (psm.depth && m_vt.IsLinear() && tex->GetTexture()->IsDepthStencil())
GL_INS("WARNING: Depth + bilinear filtering not supported");
// Performance note:
@ -4293,7 +4293,7 @@ __ri void GSRendererHW::EmulateTextureSampler(const GSTextureCache::Target* rt,
}
// Depth format
if (tex->m_texture->GetType() == GSTexture::Type::DepthStencil)
if (tex->m_texture->IsDepthStencil())
{
// Require a float conversion if the texure is a depth format
m_conf.ps.depth_fmt = (psm.bpp == 16) ? 2 : 1;
@ -4301,14 +4301,6 @@ __ri void GSRendererHW::EmulateTextureSampler(const GSTextureCache::Target* rt,
// Don't force interpolation on depth format
bilinear &= m_vt.IsLinear();
}
else if (psm.depth)
{
// Use Integral scaling
m_conf.ps.depth_fmt = 3;
// Don't force interpolation on depth format
bilinear &= m_vt.IsLinear();
}
const GSVector4 half_pixel = RealignTargetTextureCoordinate(tex);
m_conf.cb_vs.texture_offset = GSVector2(half_pixel.x, half_pixel.y);