summaryrefslogtreecommitdiff
path: root/glamor/glamor.c
diff options
context:
space:
mode:
authorLukas F. Hartmann <lukas@mntmn.com>2018-05-15 21:51:56 +0200
committerAdam Jackson <ajax@redhat.com>2018-05-16 13:57:29 -0400
commit7437b6dbdee050f8ebb3a79b9077d051c91880c3 (patch)
tree6a67bd35309d5b46d94ae8177c6b182c92fb0691 /glamor/glamor.c
parent3ab32a537840c6e6d6228b4ba62f98fbf5224f8a (diff)
glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays
Hi, I upgraded Xwayland and the assorted libraries from git masters today, and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The error was: No provider of glVertexAttribDivisor found. Requires one of: Desktop OpenGL 3.3 OpenGL ES 3.0 GL extension "GL_ANGLE_instanced_arrays" GL extension "GL_ARB_instanced_arrays" GL extension "GL_EXT_instanced_arrays" GL extension "GL_NV_instanced_arrays" The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor rendering assumes that glVertexAttribDivisor() is always available on GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor work fine again on this platform. After chatting with ajax in #xorg-devel, the following solution was proposed. This is my first time of submitting a patch, so please excuse me and advise if I'm doing it wrong ;) Cheers Lukas (mntmn) Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'glamor/glamor.c')
-rw-r--r--glamor/glamor.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 86935ed98..d984d20f3 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -563,6 +563,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
if (!glamor_check_instruction_count(gl_version))
goto fail;
+
+ /* Glamor rendering assumes that platforms with GLSL 130+
+ * have instanced arrays, but this is not always the case.
+ * etnaviv offers GLSL 140 with OpenGL 2.1.
+ */
+ if (glamor_priv->glsl_version >= 130 &&
+ !epoxy_has_gl_extension("GL_ARB_instanced_arrays"))
+ glamor_priv->glsl_version = 120;
} else {
if (gl_version < 20) {
ErrorF("Require Open GLES2.0 or later.\n");