gsdx-d3d11: Adjust anisotropic filtering handle.

Previous behaviour:
Anisotropic filtering was continuing to run even with Nearest filtering.
On opengl it doesn't run on nearest filtering. The gui for both
renderers also greys out aniso when nearest is selected.

Anisotropic filtering being able to run on palette texture. This caused
to break the rendering on palette textures for games that use it.

PR behavior:
The PR corrects both of these behaviors, Aniso won't run on palette
textures as well as nearest filtering.

Test cases for observing the issues were used: Star Ocean 3, Fifa
Street.
This commit is contained in:
lightningterror 2020-01-18 21:25:08 +01:00
parent eb2ca00e8d
commit 6bcd118b62
3 changed files with 15 additions and 7 deletions

View File

@ -46,6 +46,13 @@ GSDevice11::GSDevice11()
m_mipmap = theApp.GetConfigI("mipmap");
m_upscale_multiplier = theApp.GetConfigI("upscale_multiplier");
const BiFiltering nearest_filter = static_cast<BiFiltering>(theApp.GetConfigI("filter"));
const int aniso_level = theApp.GetConfigI("MaxAnisotropy");
if ((nearest_filter != BiFiltering::Nearest && !theApp.GetConfigB("paltex") && aniso_level))
m_aniso_filter = aniso_level;
else
m_aniso_filter = 0;
}
bool GSDevice11::LoadD3DCompiler()
@ -408,18 +415,18 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
memset(&sd, 0, sizeof(sd));
sd.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sd.Filter = m_aniso_filter ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sd.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.MinLOD = -FLT_MAX;
sd.MaxLOD = FLT_MAX;
sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy");
sd.MaxAnisotropy = m_aniso_filter;
sd.ComparisonFunc = D3D11_COMPARISON_NEVER;
hr = m_dev->CreateSamplerState(&sd, &m_convert.ln);
sd.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT;
sd.Filter = m_aniso_filter ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT;
hr = m_dev->CreateSamplerState(&sd, &m_convert.pt);

View File

@ -341,6 +341,7 @@ public:
private:
float m_hack_topleft_offset;
int m_upscale_multiplier;
int m_aniso_filter;
int m_mipmap;
int m_d3d_texsize;

View File

@ -64,13 +64,13 @@ bool GSDevice11::CreateTextureFX()
memset(&sd, 0, sizeof(sd));
sd.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT;
sd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
sd.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.MinLOD = -FLT_MAX;
sd.MaxLOD = FLT_MAX;
sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy");
sd.MaxAnisotropy = D3D11_MIN_MAXANISOTROPY;
sd.ComparisonFunc = D3D11_COMPARISON_NEVER;
hr = m_dev->CreateSamplerState(&sd, &m_palette_ss);
@ -259,7 +259,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
memset(&sd, 0, sizeof(sd));
af.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
af.Filter = m_aniso_filter ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
sd.Filter = ssel.ltf ? af.Filter : D3D11_FILTER_MIN_MAG_MIP_POINT;
sd.AddressU = ssel.tau ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP;
@ -267,7 +267,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
sd.MinLOD = -FLT_MAX;
sd.MaxLOD = FLT_MAX;
sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy");
sd.MaxAnisotropy = m_aniso_filter;
sd.ComparisonFunc = D3D11_COMPARISON_NEVER;
m_dev->CreateSamplerState(&sd, &ss0);