GS-d3d11: Mirror anisotropic filtering behavior on Direct3D11.

Don't run aniso filter on m_convert.pt and m_convert.ln samplers.
Running m_convert.pt broke shadows on color clipping.

Also use the aniso bit from hw renderer.

Aniso will now behave the same as on OpenGL.
This commit is contained in:
lightningterror 2021-12-28 13:29:02 +01:00
parent 9e705b2f53
commit 11ac758d78
3 changed files with 12 additions and 16 deletions

View File

@ -35,13 +35,6 @@ GSDevice11::GSDevice11()
m_mipmap = theApp.GetConfigI("mipmap");
m_upscale_multiplier = std::max(0, 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;
m_features.broken_point_sampler = true; // Not technically the case but the most common reason to use DX11 is because you're on AMD
m_features.geometry_shader = true;
m_features.image_load_store = false;
@ -375,18 +368,18 @@ bool GSDevice11::Create(const WindowInfo& wi)
memset(&sd, 0, sizeof(sd));
sd.Filter = m_aniso_filter ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sd.Filter = 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 = m_aniso_filter;
sd.MaxAnisotropy = D3D11_MIN_MAXANISOTROPY;
sd.ComparisonFunc = D3D11_COMPARISON_NEVER;
m_dev->CreateSamplerState(&sd, m_convert.ln.put());
sd.Filter = m_aniso_filter ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT;
sd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
m_dev->CreateSamplerState(&sd, m_convert.pt.put());
@ -1485,7 +1478,6 @@ static void preprocessSel(GSDevice11::PSSelector& sel)
static void preprocessSel(GSDevice11::PSSamplerSelector& sel)
{
sel.aniso = 0; // Not currently supported
sel.triln = 0; // Not currently supported
}

View File

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

View File

@ -220,19 +220,24 @@ void GSDevice11::SetupPS(PSSelector sel, const GSHWDrawConfig::PSConstantBuffer*
}
else
{
D3D11_SAMPLER_DESC sd, af;
D3D11_SAMPLER_DESC sd;
memset(&sd, 0, sizeof(sd));
af.Filter = m_aniso_filter ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
sd.Filter = ssel.biln ? af.Filter : D3D11_FILTER_MIN_MAG_MIP_POINT;
const int anisotropy = theApp.GetConfigI("MaxAnisotropy");
if (anisotropy && ssel.aniso)
sd.Filter = D3D11_FILTER_ANISOTROPIC;
else if (ssel.biln)
sd.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
else
sd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
sd.AddressU = ssel.tau ? 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.MinLOD = -FLT_MAX;
sd.MaxLOD = FLT_MAX;
sd.MaxAnisotropy = m_aniso_filter;
sd.MaxAnisotropy = anisotropy;
sd.ComparisonFunc = D3D11_COMPARISON_NEVER;
m_dev->CreateSamplerState(&sd, &ss0);