summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormythri.venugopal <mythri.venugopal@samsung.com>2015-02-09 14:23:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-02-09 14:28:16 +0900
commit48d8cdb4dd430667b6c70adeabd0daffbab6249f (patch)
tree835c78cf68a30b3da901d26ce3da7537d42312c7
parent28e21eac0ed832714afa12413e832ee59c5bced4 (diff)
downloadefl-48d8cdb4dd430667b6c70adeabd0daffbab6249f.tar.gz
Evas GL: Fix GLES1.1 extension initialisation bug
Summary: Extension function pointer initialisation requires glGetString(GL_EXTENSIONS). To get GLESv1 extension string, GLESv1 context has to be bound. Change involves updating extensions after GLESv1 context has been bound. Reviewers: jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1946 Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext.c34
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c6
2 files changed, 35 insertions, 5 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
index d6a30935de..f79c1ce3e6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
@@ -505,13 +505,37 @@ _evgl_api_gles1_ext_init(void)
int _curext_supported = 0;
Evas_GL_API *gles1_funcs;
const char *gles1_exts;
+ EVGL_Resource *rsc;
+ EGLint context_version;
+ EGLDisplay dpy = EGLDISPLAY_GET();
- /* Note from the EGL documentation:
- * Function pointers returned by eglGetProcAddress are independent of the
- * display and the currently bound context and may be used by any context
- * which supports the extension.
- * So, we don't need to check that GLESv1 is current.
+ /* glGetString returns the information for the currently bound context
+ * So, update gles1_exts only if GLES1 context is currently bound.
+ * Check here if GLESv1 is current
*/
+ if (!(rsc=_evgl_tls_resource_get()))
+ {
+ ERR("Unable to initialize GLES1 extensions. Error retrieving tls");
+ return EINA_FALSE;
+ }
+
+ if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
+ {
+ DBG("Unable to initialize GLES1 extensions. Engine not initialised");
+ return EINA_FALSE;
+ }
+
+ if (!eglQueryContext(dpy, rsc->current_ctx->context, EGL_CONTEXT_CLIENT_VERSION, &context_version))
+ {
+ ERR("Unable to initialize GLES1 extensions. eglQueryContext failed 0x%x", eglGetError());
+ return EINA_FALSE;
+ }
+
+ if (context_version != EVAS_GL_GLES_1_X)
+ {
+ DBG("GLESv1 context not bound");
+ return EINA_FALSE;
+ }
gles1_funcs = _evgl_api_gles1_internal_get();
if (!gles1_funcs || !gles1_funcs->glGetString)
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 242127a985..e23777d44e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -2304,6 +2304,12 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
rsc->current_ctx = ctx;
rsc->current_eng = eng_data;
+ // Update GLESv1 extension functions after GLESv1 context is bound
+ if (ctx->version == EVAS_GL_GLES_1_X)
+ {
+ evgl_api_gles1_ext_get(gles1_funcs);
+ }
+
_surface_context_list_print();
return 1;