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:
parent
0c0d582f24
commit
e2ad3b1b20
@ -5379,8 +5379,7 @@ namespace dxvk {
|
||||
colorInfo.minFilter = DecodeFilter(cKey.MinFilter);
|
||||
colorInfo.mipmapMode = mipFilter.MipFilter;
|
||||
colorInfo.maxAnisotropy = float(cKey.MaxAnisotropy);
|
||||
colorInfo.useAnisotropy = IsAnisotropic(cKey.MinFilter)
|
||||
|| IsAnisotropic(cKey.MagFilter);
|
||||
colorInfo.useAnisotropy = cKey.MaxAnisotropy > 1;
|
||||
colorInfo.mipmapLodBias = cKey.MipmapLodBias;
|
||||
colorInfo.mipmapLodMin = mipFilter.MipsEnabled ? float(cKey.MaxMipLevel) : 0;
|
||||
colorInfo.mipmapLodMax = mipFilter.MipsEnabled ? FLT_MAX : 0;
|
||||
|
@ -36,11 +36,15 @@ namespace dxvk {
|
||||
key.AddressV = std::clamp(key.AddressV, D3DTADDRESS_WRAP, D3DTADDRESS_MIRRORONCE);
|
||||
key.AddressW = std::clamp(key.AddressW, D3DTADDRESS_WRAP, D3DTADDRESS_MIRRORONCE);
|
||||
|
||||
key.MagFilter = std::clamp(key.MagFilter, D3DTEXF_NONE, D3DTEXF_ANISOTROPIC);
|
||||
key.MinFilter = std::clamp(key.MinFilter, D3DTEXF_NONE, D3DTEXF_ANISOTROPIC);
|
||||
key.MipFilter = std::clamp(key.MipFilter, D3DTEXF_NONE, D3DTEXF_ANISOTROPIC);
|
||||
bool hasAnisotropy = IsAnisotropic(key.MagFilter) || IsAnisotropic(key.MinFilter);
|
||||
|
||||
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) {
|
||||
// May as well try and keep slots down.
|
||||
|
Loading…
x
Reference in New Issue
Block a user