diff --git a/src/modules/graphics/opengl/OpenGL.cpp b/src/modules/graphics/opengl/OpenGL.cpp index 7c4f50c99..9cf2e4715 100644 --- a/src/modules/graphics/opengl/OpenGL.cpp +++ b/src/modules/graphics/opengl/OpenGL.cpp @@ -124,6 +124,20 @@ bool OpenGL::initContext() if (!gladLoadGLLoader(LOVEGetProcAddress)) return false; + initVendor(); + + bugs = {}; + + if (GLAD_ES_VERSION_3_0 && !GLAD_ES_VERSION_3_1) + { + const char *device = (const char *) glGetString(GL_RENDERER); + if (getVendor() == VENDOR_VIVANTE && strstr(device, "Vivante GC7000UL")) + bugs.brokenGLES3 = true; + } + + if (bugs.brokenGLES3) + GLAD_ES_VERSION_3_0 = false; + if (GLAD_VERSION_3_2) { GLint profileMask = 0; @@ -134,9 +148,6 @@ bool OpenGL::initContext() coreProfile = false; initOpenGLFunctions(); - initVendor(); - - bugs = {}; #if defined(LOVE_WINDOWS) || defined(LOVE_LINUX) // See the comments in OpenGL.h. diff --git a/src/modules/graphics/opengl/OpenGL.h b/src/modules/graphics/opengl/OpenGL.h index fdaf79e70..fb239b5e1 100644 --- a/src/modules/graphics/opengl/OpenGL.h +++ b/src/modules/graphics/opengl/OpenGL.h @@ -184,6 +184,13 @@ public: **/ bool brokenSRGB; + /** + * Some Android graphics drivers claim to support GLES3.0 but have bugs + * with certain aspects that users expect to work. For example: + * https://github.com/love2d/love-android/issues/204 + **/ + bool brokenGLES3; + /** * Other bugs which have workarounds that don't use conditional code at * the moment: diff --git a/src/modules/graphics/wrap_GraphicsShader.lua b/src/modules/graphics/wrap_GraphicsShader.lua index 81f793482..1107c26f8 100644 --- a/src/modules/graphics/wrap_GraphicsShader.lua +++ b/src/modules/graphics/wrap_GraphicsShader.lua @@ -95,7 +95,7 @@ GLSL.FUNCTIONS = [[ #if __VERSION__ >= 300 || defined(GL_OES_texture_3D) precision lowp sampler3D; #endif - #if __VERSION__ >= 300 + #if __VERSION__ >= 300 && !defined(LOVE_GLSL1_ON_GLSL3) precision lowp sampler2DShadow; precision lowp samplerCubeShadow; precision lowp sampler2DArrayShadow;