From: Cedric BAIL Date: Fri, 25 Aug 2017 17:51:59 +0000 (-0700) Subject: evas: make all window GLES3 or none. X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2963 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39d4e343b0ab8ef93c1240454fba75c287e64a07;p=platform%2Fupstream%2Fefl.git evas: make all window GLES3 or none. --- diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index c885353..0a9a69c 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -503,7 +503,7 @@ evgl_eng_context_create(void *data, void *share_ctx, Evas_GL_Context_Version ver * But this leads to some issues, namely that the list of extensions is * different, and MSAA surfaces also work differently. */ - if (eng_get_ob(re)->gles3 && (version >= EVAS_GL_GLES_2_X)) + if (gles3_supported && (version >= EVAS_GL_GLES_2_X)) version = 3; context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; @@ -718,7 +718,7 @@ evgl_eng_pbuffer_surface_create(void *data, EVGL_Surface *sfc, } config_attrs[i++] = EGL_RENDERABLE_TYPE; - if (eng_get_ob(re)->gles3) + if (gles3_supported) config_attrs[i++] = EGL_OPENGL_ES3_BIT_KHR; else config_attrs[i++] = EGL_OPENGL_ES2_BIT; @@ -2511,7 +2511,7 @@ eng_image_native_set(void *engine, void *image, void *native) config_attrs[i++] = EGL_STENCIL_SIZE; config_attrs[i++] = 0; config_attrs[i++] = EGL_RENDERABLE_TYPE; - if (eng_get_ob(re)->gles3) + if (gles3_supported) config_attrs[i++] = EGL_OPENGL_ES3_BIT_KHR; else config_attrs[i++] = EGL_OPENGL_ES2_BIT; diff --git a/src/modules/evas/engines/gl_x11/evas_engine.h b/src/modules/evas/engines/gl_x11/evas_engine.h index a37fb6f..29c8a19 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.h +++ b/src/modules/evas/engines/gl_x11/evas_engine.h @@ -65,7 +65,6 @@ struct _Outbuf EGLSurface egl_surface; EGLConfig egl_config; EGLDisplay egl_disp; - Eina_Bool gles3 : 1; #else GLXContext context; GLXWindow glxwin; @@ -227,4 +226,6 @@ Eina_Bool __glXMakeContextCurrent(Display *disp, GLXDrawable glxwin, GLXContext context); #endif +extern Eina_Bool gles3_supported; + #endif diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c b/src/modules/evas/engines/gl_x11/evas_x_main.c index da38d3e..b9d733e 100644 --- a/src/modules/evas/engines/gl_x11/evas_x_main.c +++ b/src/modules/evas/engines/gl_x11/evas_x_main.c @@ -10,10 +10,12 @@ static Eina_TLS _context_key = 0; typedef void (*glsym_func_void) (); glsym_func_void glsym_evas_gl_common_context_restore_set = NULL; +Eina_Bool gles3_supported = EINA_FALSE; + #ifdef GL_GLES typedef EGLContext GLContext; typedef EGLConfig GLConfig; -static int gles3_supported = -1; +static Eina_Bool gles3_probed = EINA_FALSE; #else // FIXME: this will only work for 1 display connection (glx land can have > 1) typedef GLXContext GLContext; @@ -239,7 +241,6 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info, // EGL / GLES #ifdef GL_GLES - gw->gles3 = gles3_supported; gw->egl_disp = _x11_eglGetDisplay(gw->disp); if (!gw->egl_disp) { @@ -277,7 +278,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info, try_gles2: context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; - context_attrs[1] = gw->gles3 ? 3 : 2; + context_attrs[1] = gles3_supported ? 3 : 2; context_attrs[2] = EGL_NONE; context = _tls_context_get(); @@ -286,11 +287,11 @@ try_gles2: if (gw->egl_context == EGL_NO_CONTEXT) { ERR("eglCreateContext() fail. code=%#x", eglGetError()); - if (gw->gles3) + if (gles3_supported) { /* Note: this shouldn't happen */ ERR("Trying again with an Open GL ES 2 context (fallback)."); - gw->gles3 = EINA_FALSE; + gles3_supported = EINA_FALSE; goto try_gles2; } eng_window_free(gw); @@ -873,9 +874,9 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) } /* detect GLES 3.x support */ - if (gles3_supported == -1) + if (gles3_probed == EINA_FALSE) { - gles3_supported = EINA_FALSE; + gles3_probed = EINA_TRUE; eglexts = eglQueryString(egl_disp, EGL_EXTENSIONS); if (eglexts && strstr(eglexts, "EGL_KHR_create_context")) { @@ -1299,7 +1300,7 @@ eng_gl_context_new(Outbuf *win) if (!ctx) return NULL; #if GL_GLES - if (win->gles3) + if (gles3_supported) context_attrs[1] = 3; ctx->context = eglCreateContext(win->egl_disp, win->egl_config, win->egl_context, context_attrs);