From: Arnaud Vrac <av...@freebox.fr> Some GL drivers do not expose useful extensions like GL_EXT_texture_rg or GL_EXT_unpack_subimage, while they are actually supported. Since those extensions are part of the ES 3.0 core spec, we can workaround this issue by creating an ES3 context. We fallback to ES2 if the creation fails. --- libweston/gl-renderer.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c index 0a7db13f..e237edf2 100644 --- a/libweston/gl-renderer.c +++ b/libweston/gl-renderer.c @@ -3604,8 +3604,8 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) EGLConfig context_config; EGLBoolean ret; - static const EGLint context_attribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, + EGLint context_attribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 0, EGL_NONE }; @@ -3620,12 +3620,22 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) if (gr->has_configless_context) context_config = EGL_NO_CONFIG_KHR; + /* try to create an OpenGLES 3 context first */ + context_attribs[1] = 3; gr->egl_context = eglCreateContext(gr->egl_display, context_config, EGL_NO_CONTEXT, context_attribs); if (gr->egl_context == NULL) { - weston_log("failed to create context\n"); - gl_renderer_print_egl_error_state(); - return -1; + /* and then fallback to OpenGLES 2 */ + context_attribs[1] = 2; + gr->egl_context = eglCreateContext(gr->egl_display, + context_config, + EGL_NO_CONTEXT, + context_attribs); + if (gr->egl_context == NULL) { + weston_log("failed to create context\n"); + gl_renderer_print_egl_error_state(); + return -1; + } } ret = eglMakeCurrent(gr->egl_display, egl_surface, -- 2.15.0 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel