Add new texture filtering "Auto Max Quality" that tweaks texture filtering for best quality.

It does this by enforcing mipmapping and minification filters, and
always autogenerates mipmaps and enforces anisotropic filtering for all
modes (if that's separately enabled).

This looks nice and flicker free in most games without any additional
tweaking, including GTA and Burnout which have long been painfully
flickery in the distance due to undersampling.

Needs a bit more testing before merge, maybe.

Fixes #13888
This commit is contained in:
Henrik Rydgård 2021-09-03 00:06:49 +02:00
parent 54bb824d37
commit 6b76bcf070
11 changed files with 50 additions and 12 deletions

View file

@ -241,10 +241,18 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac
}
break;
case TEX_FILTER_FORCE_NEAREST:
default:
// Just force to nearest without checks. Safe (but ugly).
forceFiltering = TEX_FILTER_FORCE_NEAREST;
break;
case TEX_FILTER_AUTO_MAX_QUALITY:
default:
forceFiltering = TEX_FILTER_AUTO_MAX_QUALITY;
if (gstate.isModeThrough() && g_Config.iInternalResolution != 1) {
bool uglyColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue() && gstate.getColorTestRef() != 0;
if (uglyColorTest)
forceFiltering = TEX_FILTER_FORCE_NEAREST;
}
break;
}
}
@ -260,6 +268,18 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac
key.magFilt = 0;
key.minFilt = 0;
break;
case TEX_FILTER_AUTO_MAX_QUALITY:
// NOTE: We do not override magfilt here. If a game should have pixellated filtering,
// let it keep it. But we do enforce minification and mipmap filtering and max out the level.
// Later we'll also auto-generate any missing mipmaps.
key.minFilt = 1;
key.mipFilt = 1;
key.maxLevel = 9 * 256;
key.lodBias = 0.0f;
if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
key.aniso = true;
}
break;
}
return key;