1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[d3d9] Improve sampler anisotropy normalization

This commit is contained in:
Joshua Ashton 2020-05-21 08:58:39 +01:00
parent 0c0d582f24
commit e2ad3b1b20
2 changed files with 9 additions and 6 deletions

View File

@ -5379,8 +5379,7 @@ namespace dxvk {
colorInfo.minFilter = DecodeFilter(cKey.MinFilter); colorInfo.minFilter = DecodeFilter(cKey.MinFilter);
colorInfo.mipmapMode = mipFilter.MipFilter; colorInfo.mipmapMode = mipFilter.MipFilter;
colorInfo.maxAnisotropy = float(cKey.MaxAnisotropy); colorInfo.maxAnisotropy = float(cKey.MaxAnisotropy);
colorInfo.useAnisotropy = IsAnisotropic(cKey.MinFilter) colorInfo.useAnisotropy = cKey.MaxAnisotropy > 1;
|| IsAnisotropic(cKey.MagFilter);
colorInfo.mipmapLodBias = cKey.MipmapLodBias; colorInfo.mipmapLodBias = cKey.MipmapLodBias;
colorInfo.mipmapLodMin = mipFilter.MipsEnabled ? float(cKey.MaxMipLevel) : 0; colorInfo.mipmapLodMin = mipFilter.MipsEnabled ? float(cKey.MaxMipLevel) : 0;
colorInfo.mipmapLodMax = mipFilter.MipsEnabled ? FLT_MAX : 0; colorInfo.mipmapLodMax = mipFilter.MipsEnabled ? FLT_MAX : 0;

View File

@ -36,11 +36,15 @@ namespace dxvk {
key.AddressV = std::clamp(key.AddressV, D3DTADDRESS_WRAP, D3DTADDRESS_MIRRORONCE); key.AddressV = std::clamp(key.AddressV, D3DTADDRESS_WRAP, D3DTADDRESS_MIRRORONCE);
key.AddressW = std::clamp(key.AddressW, D3DTADDRESS_WRAP, D3DTADDRESS_MIRRORONCE); key.AddressW = std::clamp(key.AddressW, D3DTADDRESS_WRAP, D3DTADDRESS_MIRRORONCE);
key.MagFilter = std::clamp(key.MagFilter, D3DTEXF_NONE, D3DTEXF_ANISOTROPIC); bool hasAnisotropy = IsAnisotropic(key.MagFilter) || IsAnisotropic(key.MinFilter);
key.MinFilter = std::clamp(key.MinFilter, D3DTEXF_NONE, D3DTEXF_ANISOTROPIC);
key.MipFilter = std::clamp(key.MipFilter, D3DTEXF_NONE, D3DTEXF_ANISOTROPIC);
key.MaxAnisotropy = std::min<DWORD>(key.MaxAnisotropy, 16); key.MagFilter = std::clamp(key.MagFilter, D3DTEXF_NONE, D3DTEXF_LINEAR);
key.MinFilter = std::clamp(key.MinFilter, D3DTEXF_NONE, D3DTEXF_LINEAR);
key.MipFilter = std::clamp(key.MipFilter, D3DTEXF_NONE, D3DTEXF_LINEAR);
key.MaxAnisotropy = hasAnisotropy
? std::clamp<DWORD>(key.MaxAnisotropy, 1, 16)
: 1;
if (key.MipFilter == D3DTEXF_NONE) { if (key.MipFilter == D3DTEXF_NONE) {
// May as well try and keep slots down. // May as well try and keep slots down.