From d87ad2c3d6a6ff52e625ad03b8aa910d8c27c9c3 Mon Sep 17 00:00:00 2001 From: Logan McNaughton Date: Sat, 18 Mar 2017 23:05:10 -0600 Subject: [PATCH] Disable LOD emulation on GLES2 devices that can't support it --- .../OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp | 6 ++++-- src/Graphics/OpenGLContext/opengl_GLInfo.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp index 8f470d3e..d30fe734 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp @@ -415,8 +415,10 @@ public: { if (_glinfo.isGLES2) { m_part = "#version 100 \n"; - m_part += "#extension GL_EXT_shader_texture_lod : enable \n"; - m_part += "#extension GL_OES_standard_derivatives : enable \n"; + if (config.generalEmulation.enableLOD) { + m_part += "#extension GL_EXT_shader_texture_lod : enable \n"; + m_part += "#extension GL_OES_standard_derivatives : enable \n"; + } m_part += "#if (__VERSION__ > 120) \n" "# define IN in \n" diff --git a/src/Graphics/OpenGLContext/opengl_GLInfo.cpp b/src/Graphics/OpenGLContext/opengl_GLInfo.cpp index 42074956..0759bdaa 100644 --- a/src/Graphics/OpenGLContext/opengl_GLInfo.cpp +++ b/src/Graphics/OpenGLContext/opengl_GLInfo.cpp @@ -75,4 +75,10 @@ void GLInfo::init() { LOG(LOG_WARNING, "Async color buffer copies are not supported on GLES2\n"); } #endif + if (isGLES2 && config.generalEmulation.enableLOD) { + if (!Utils::isExtensionSupported(*this, "GL_EXT_shader_texture_lod") || !Utils::isExtensionSupported(*this, "GL_OES_standard_derivatives")) { + config.generalEmulation.enableLOD = 0; + LOG(LOG_WARNING, "LOD emulation not possible on this device\n"); + } + } }