From f95459ab0d8d7b807b261be9ebae99d804d3fb13 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Fri, 3 Mar 2017 13:58:27 +0100 Subject: [PATCH] Fix bug where we tried to set aniso even if unsupported. Fixes #9377 --- GPU/GLES/GPU_GLES.cpp | 3 ++- GPU/GLES/TextureCacheGLES.cpp | 4 +++- ext/native/gfx_es2/gpu_features.cpp | 1 + ext/native/gfx_es2/gpu_features.h | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 6bd2e5b155..8ead5654ec 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -594,7 +594,8 @@ void GPU_GLES::CheckGPUFeatures() { if (gl_extensions.GLES3 || !gl_extensions.IsGLES) features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL; - features |= GPU_SUPPORTS_ANISOTROPY; + if (gl_extensions.EXT_texture_filter_anisotropic) + features |= GPU_SUPPORTS_ANISOTROPY; if (gl_extensions.GLES3 || gl_extensions.EXT_gpu_shader4 || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 1)/*GLSL 1.4*/)) diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index 3340ff2045..17c7775e8d 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -709,7 +709,9 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY)) { int aniso = 1 << g_Config.iAnisotropyLevel; float anisotropyLevel = (float) aniso > maxAnisotropyLevel ? maxAnisotropyLevel : (float) aniso; - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropyLevel); + if (anisotropyLevel > 1.0f) { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropyLevel); + } } // This will rebind it, but that's okay. diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index afe59835df..bedb274265 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -277,6 +277,7 @@ void CheckGLExtensions() { gl_extensions.ARB_copy_image = strstr(extString, "GL_ARB_copy_image") != 0; gl_extensions.ARB_vertex_array_object = strstr(extString, "GL_ARB_vertex_array_object") != 0; gl_extensions.ARB_texture_float = strstr(extString, "GL_ARB_texture_float") != 0; + gl_extensions.EXT_texture_filter_anisotropic = strstr(extString, "GL_EXT_texture_filter_anisotropic") != 0; if (gl_extensions.IsGLES) { gl_extensions.OES_texture_npot = strstr(extString, "GL_OES_texture_npot") != 0; diff --git a/ext/native/gfx_es2/gpu_features.h b/ext/native/gfx_es2/gpu_features.h index 2cccb23bdd..d1b36573dc 100644 --- a/ext/native/gfx_es2/gpu_features.h +++ b/ext/native/gfx_es2/gpu_features.h @@ -71,6 +71,7 @@ struct GLExtensions { bool EXT_blend_minmax; bool EXT_framebuffer_object; bool EXT_copy_image; + bool EXT_texture_filter_anisotropic; bool PBO_EXT; // NV