GS/HW: Make trilinear filtering behavior consistent across backends

Previously, triln=0 would result in nearest mipmap filtering in
D3D/Vulkan, but forced base level in OpenGL.
This commit is contained in:
Connor McLaughlin 2022-09-28 22:05:20 +10:00 committed by refractionpcsx2
parent f2e6c61bfa
commit 3bbb510b7a
4 changed files with 4 additions and 4 deletions

View File

@ -259,7 +259,7 @@ void GSDevice11::SetupPS(const PSSelector& sel, const GSHWDrawConfig::PSConstant
sd.AddressV = ssel.tav ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressV = ssel.tav ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP;
sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.MinLOD = 0.0f; sd.MinLOD = 0.0f;
sd.MaxLOD = ssel.lodclamp ? 0.0f : FLT_MAX; sd.MaxLOD = (ssel.lodclamp || !ssel.UseMipmapFiltering()) ? 0.25f : FLT_MAX;
sd.MaxAnisotropy = std::clamp(anisotropy, 1, 16); sd.MaxAnisotropy = std::clamp(anisotropy, 1, 16);
sd.ComparisonFunc = D3D11_COMPARISON_NEVER; sd.ComparisonFunc = D3D11_COMPARISON_NEVER;

View File

@ -908,7 +908,7 @@ bool GSDevice12::GetSampler(D3D12::DescriptorHandle* cpu_handle, GSHWDrawConfig:
sd.AddressV = ss.tav ? D3D12_TEXTURE_ADDRESS_MODE_WRAP : D3D12_TEXTURE_ADDRESS_MODE_CLAMP; sd.AddressV = ss.tav ? D3D12_TEXTURE_ADDRESS_MODE_WRAP : D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
sd.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; sd.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
sd.MinLOD = 0.0f; sd.MinLOD = 0.0f;
sd.MaxLOD = ss.lodclamp ? 0.0f : FLT_MAX; sd.MaxLOD = (ss.lodclamp || !ss.UseMipmapFiltering()) ? 0.25f : FLT_MAX;
sd.MaxAnisotropy = std::clamp(GSConfig.MaxAnisotropy, 1, 16); sd.MaxAnisotropy = std::clamp(GSConfig.MaxAnisotropy, 1, 16);
sd.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER; sd.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;

View File

@ -883,7 +883,7 @@ GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel)
} }
glSamplerParameterf(sampler, GL_TEXTURE_MIN_LOD, -1000.0f); glSamplerParameterf(sampler, GL_TEXTURE_MIN_LOD, -1000.0f);
glSamplerParameterf(sampler, GL_TEXTURE_MAX_LOD, sel.lodclamp ? 0.0f : 1000.0f); glSamplerParameterf(sampler, GL_TEXTURE_MAX_LOD, sel.lodclamp ? 0.25f : 1000.0f);
if (sel.tau) if (sel.tau)
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_REPEAT); glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_REPEAT);

View File

@ -1029,7 +1029,7 @@ VkSampler GSDeviceVK::GetSampler(GSHWDrawConfig::SamplerSelector ss)
VK_FALSE, // compare enable VK_FALSE, // compare enable
VK_COMPARE_OP_ALWAYS, // compare op VK_COMPARE_OP_ALWAYS, // compare op
0.0f, // min lod 0.0f, // min lod
ss.lodclamp ? 0.25f : VK_LOD_CLAMP_NONE, // max lod (ss.lodclamp || !ss.UseMipmapFiltering()) ? 0.25f : VK_LOD_CLAMP_NONE, // max lod
VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, // border VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, // border
VK_FALSE // unnormalized coordinates VK_FALSE // unnormalized coordinates
}; };