- Test whether texture filtering is allowed before unconditionally allowing anisotrophy in the GLES backend.

This commit is contained in:
Mitchell Richters 2022-10-08 18:06:03 +11:00 committed by Christoph Oelckers
parent 4d02cdcce9
commit ca521f8a1e

View file

@ -67,6 +67,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
int filter = sysCallbacks.DisableTextureFilter && sysCallbacks.DisableTextureFilter() ? 0 : gl_texture_filter;
bool anisoAvailable = gles.anistropicFilterAvailable && (!sysCallbacks.DisableTextureFilter || !sysCallbacks.DisableTextureFilter());
glActiveTexture(GL_TEXTURE0 + texunit);
switch (num)
@ -78,7 +79,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -90,7 +91,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -102,7 +103,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -114,7 +115,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
}
break;
@ -124,7 +125,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
@ -133,7 +134,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
@ -142,7 +143,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
@ -151,7 +152,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
@ -160,7 +161,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
@ -169,7 +170,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
if (gles.anistropicFilterAvailable)
if (anisoAvailable)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
break;
}