jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e789b24ff4689468dbe91d969bb3b40d668d044e

commit e789b24ff4689468dbe91d969bb3b40d668d044e
Author: Dongyeon Kim <dy5....@samsung.com>
Date:   Tue Apr 14 15:51:32 2015 +0900

    Evas GL: 1.x support for GLX
    
    Summary:
    Now we can support EVAS_GL_GLES_1_X version for GLX backend
    with both direct and indirect rendering.
    Refactored api get functions to have similar code path for each version.
    @feature
    
    Test Plan: Evas GL test case
    
    Reviewers: cedric, jpeg
    
    Subscribers: cedric, mer.kim, mythri, wonsik
    
    Differential Revision: https://phab.enlightenment.org/D2342
---
 src/modules/evas/engines/gl_common/evas_gl_api.c   |  35 +++----
 .../evas/engines/gl_common/evas_gl_api_ext.c       | 116 +++++++++------------
 .../evas/engines/gl_common/evas_gl_api_ext.h       |   7 +-
 .../evas/engines/gl_common/evas_gl_api_ext_def.h   |   1 +
 .../evas/engines/gl_common/evas_gl_api_gles1.c     |   6 --
 src/modules/evas/engines/gl_common/evas_gl_core.c  |  46 +++-----
 src/modules/evas/engines/gl_common/evas_gl_core.h  |   2 +-
 .../evas/engines/gl_common/evas_gl_core_private.h  |   8 +-
 src/modules/evas/engines/gl_generic/evas_engine.c  |   2 +-
 src/modules/evas/engines/gl_x11/evas_engine.c      |   7 --
 10 files changed, 86 insertions(+), 144 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c 
b/src/modules/evas/engines/gl_common/evas_gl_api.c
index b22189c..6ef7a3d 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -4716,7 +4716,7 @@ _evgld_glViewport(GLint x, GLint y, GLsizei width, 
GLsizei height)
 //-------------------------------------------------------------//
 
 static void
-_normal_gl_api_get(Evas_GL_API *funcs)
+_normal_gles2_api_get(Evas_GL_API *funcs)
 {
    funcs->version = EVAS_GL_API_VERSION;
 
@@ -4892,8 +4892,6 @@ _normal_gl_api_get(Evas_GL_API *funcs)
    ORD(glReleaseShaderCompiler);
 
 #undef ORD
-
-   evgl_api_ext_get(funcs);
 }
 
 static void
@@ -4915,7 +4913,7 @@ _direct_scissor_off_api_get(Evas_GL_API *funcs)
 
 
 static void
-_debug_gl_api_get(Evas_GL_API *funcs)
+_debug_gles2_api_get(Evas_GL_API *funcs)
 {
    funcs->version = EVAS_GL_API_VERSION;
 
@@ -5065,20 +5063,18 @@ _debug_gl_api_get(Evas_GL_API *funcs)
    ORD(glBindFramebuffer);
    ORD(glBindRenderbuffer);
 #undef ORD
-
-   evgl_api_ext_get(funcs);
 }
 
 void
-_evgl_api_get(Evas_GL_API *funcs, int debug)
+_evgl_api_gles2_get(Evas_GL_API *funcs, Eina_Bool debug)
 {
    if (debug)
-      _debug_gl_api_get(funcs);
+     _debug_gles2_api_get(funcs);
    else
-      _normal_gl_api_get(funcs);
+     _normal_gles2_api_get(funcs);
 
    if (evgl_engine->direct_scissor_off)
-      _direct_scissor_off_api_get(funcs);
+     _direct_scissor_off_api_get(funcs);
 }
 
 static void
@@ -5368,8 +5364,6 @@ _normal_gles3_api_get(Evas_GL_API *funcs)
    ORD(glReleaseShaderCompiler);
 
 #undef ORD
-
-   evgl_api_gles3_ext_get(funcs);
 }
 
 static void
@@ -5628,8 +5622,6 @@ _debug_gles3_api_get(Evas_GL_API *funcs)
    ORD(glVertexAttribIPointer);
    ORD(glWaitSync);
 #undef ORD
-
-   evgl_api_gles3_ext_get(funcs);
 }
 
 
@@ -5761,7 +5753,7 @@ _evgl_load_gles3_apis(void *dl_handle, Evas_GL_API *funcs)
 
 
 static Eina_Bool
-_evgl_api_init(void)
+_evgl_gles3_api_init(void)
 {
    static Eina_Bool _initialized = EINA_FALSE;
    if (_initialized) return EINA_TRUE;
@@ -5797,20 +5789,17 @@ _evgl_api_init(void)
      {
         return EINA_FALSE;
      }
-/*  TODO
-   if (!_evgl_api_gles3_ext_init())
-     WRN("Could not initialize OpenGL ES 1 extensions yet.");
-*/
+
    _initialized = EINA_TRUE;
    return EINA_TRUE;
 }
 
 
-Eina_Bool
+void
 _evgl_api_gles3_get(Evas_GL_API *funcs, Eina_Bool debug)
 {
-   if(!_evgl_api_init())
-      return EINA_FALSE;
+   if (!_evgl_gles3_api_init())
+     return;
 
    if (debug)
      _debug_gles3_api_get(funcs);
@@ -5820,7 +5809,7 @@ _evgl_api_gles3_get(Evas_GL_API *funcs, Eina_Bool debug)
    if (evgl_engine->direct_scissor_off)
      _direct_scissor_off_api_get(funcs);
 
-   return EINA_TRUE;
+   return;
 }
 
 Evas_GL_API *
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 1aae248..1d9869e 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
@@ -310,9 +310,13 @@ evgl_evasglQueryWaylandBuffer(Evas_GL *evas_gl EINA_UNUSED,
 //  5: GLESv3 and GLESv2 initialized,
 //  7: GLESv3 + GLESv2  + GLESv1 all initialized.
 static int _evgl_api_ext_status = 0;
+#define EVASGL_API_GLES2_EXT_INITIALIZED 0x1
+#define EVASGL_API_GLES1_EXT_INITIALIZED 0x2
+#define EVASGL_API_GLES3_EXT_INITIALIZED 0x4
+
 
 Eina_Bool
-evgl_api_ext_init(void *getproc, const char *glueexts)
+_evgl_api_gles2_ext_init(void *getproc, const char *glueexts)
 {
    const char *glexts;
    fp_getproc gp = (fp_getproc)getproc;
@@ -476,19 +480,22 @@ evgl_api_ext_init(void *getproc, const char *glueexts)
    eina_strbuf_free(sb);
    eina_strbuf_free(sboff);
 
-  _evgl_api_ext_status = 1;
+  _evgl_api_ext_status |= EVASGL_API_GLES2_EXT_INITIALIZED;
    return EINA_TRUE;
 }
 
 void
-evgl_api_ext_get(Evas_GL_API *gl_funcs)
+evgl_api_gles2_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char 
*glueexts)
 {
-   if (_evgl_api_ext_status < 1)
+   if (!(_evgl_api_ext_status & EVASGL_API_GLES2_EXT_INITIALIZED))
      {
-        ERR("EVGL extension is not yet initialized.");
-        return;
+        DBG("Initializing GLESv2 extensions...");
+        if (!_evgl_api_gles2_ext_init(getproc, glueexts))
+          {
+             ERR("GLESv2 extensions initialization failed");
+             return;
+          }
      }
-
 #define ORD(f) EVAS_API_OVERRIDE(f, gl_funcs, gl_ext_sym_)
 
    
/////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -541,23 +548,21 @@ evgl_api_ext_get(Evas_GL_API *gl_funcs)
 }
 
 Eina_Bool
-_evgl_api_gles1_ext_init(void)
+_evgl_api_gles1_ext_init(void *getproc, const char *glueexts)
 {
-   // Return if GLESv1 ext is already intiialised
-   if (_evgl_api_ext_status & 0x2)
-     return EINA_TRUE;
-
-#ifdef GL_GLES
+   const char *glexts;
+   fp_getproc gp = (fp_getproc)getproc;
    int _curext_supported = 0;
    Evas_GL_API *gles1_funcs;
-   const char *gles1_exts, *eglexts;
+   Eina_Strbuf *sb = eina_strbuf_new();
+
+#ifdef GL_GLES
    EVGL_Resource *rsc;
    EGLint context_version;
    EGLDisplay dpy = EGLDISPLAY_GET();
-   Eina_Strbuf *sb = eina_strbuf_new();
 
    /* glGetString returns the information for the currently bound context
-    * So, update gles1_exts only if GLES1 context is currently bound.
+    * So, update glexts only if GLES1 context is currently bound.
     * Check here if GLESv1 is current
     */
    if (!(rsc=_evgl_tls_resource_get()))
@@ -568,7 +573,7 @@ _evgl_api_gles1_ext_init(void)
 
    if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
      {
-        DBG("Unable to initialize GLES1 extensions. Engine not initialised");
+        DBG("Unable to initialize GLES1 extensions. Engine not initialized");
         return EINA_FALSE;
      }
 
@@ -583,6 +588,7 @@ _evgl_api_gles1_ext_init(void)
         DBG("GLESv1 context not bound");
         return EINA_FALSE;
      }
+#endif
 
    gles1_funcs = _evgl_api_gles1_internal_get();
    if (!gles1_funcs || !gles1_funcs->glGetString)
@@ -591,27 +597,20 @@ _evgl_api_gles1_ext_init(void)
         return EINA_FALSE;
      }
 
-   gles1_exts = (const char *) gles1_funcs->glGetString(GL_EXTENSIONS);
-   if (!gles1_exts)
+   glexts = (const char *) gles1_funcs->glGetString(GL_EXTENSIONS);
+   if (!glexts)
      {
         ERR("GLESv1:glGetString(GL_EXTENSIONS) returned NULL!");
         return EINA_FALSE;
      }
 
-   eglexts = eglQueryString(dpy, EGL_EXTENSIONS);
-   if (!eglexts)
-     {
-        ERR("eglQueryString(EGL_EXTENSIONS) returned NULL!");
-        eglexts = "";
-     }
-
    
/////////////////////////////////////////////////////////////////////////////////////////////////////
    // Scanning supported extensions, sets the variables
    
/////////////////////////////////////////////////////////////////////////////////////////////////////
 
    // Preparing all the magic macros
 #define GETPROCADDR(sym) \
-   ((__typeof__((*drvfunc))) (eglGetProcAddress(sym)))
+   (((!(*drvfunc)) && (gp)) ? (__typeof__((*drvfunc)))gp(sym) : 
(__typeof__((*drvfunc)))dlsym(RTLD_DEFAULT, sym))
 
 #define _EVASGL_EXT_BEGIN(name) \
    { \
@@ -622,7 +621,7 @@ _evgl_api_gles1_ext_init(void)
    }
 
 #define _EVASGL_EXT_CHECK_SUPPORT(name) \
-   ((strstr(gles1_exts, name) != NULL) || (strstr(eglexts, name) != NULL))
+   ((strstr(glexts, name) != NULL) || (strstr(glueexts, name) != NULL))
 
 #define _EVASGL_EXT_DISCARD_SUPPORT() \
    *ext_support = 0;
@@ -743,27 +742,17 @@ _evgl_api_gles1_ext_init(void)
      DBG("GLES1: List of supported extensions:\n%s", _gles1_ext_string);
 
    // GLESv1 version has been initialized!
-   _evgl_api_ext_status |= 0x2;
+   _evgl_api_ext_status |= EVASGL_API_GLES1_EXT_INITIALIZED;
    return EINA_TRUE;
-#else
-   ERR("GLESv1 support is not implemented for GLX");
-   return EINA_FALSE;
-#endif
 }
 
 void
-evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs)
+evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char 
*glueexts)
 {
-   if (_evgl_api_ext_status < 1)
-     {
-        ERR("EVGL extension is not yet initialized.");
-        return;
-     }
-
-   if (!(_evgl_api_ext_status & 0x2))
+   if (!(_evgl_api_ext_status & EVASGL_API_GLES1_EXT_INITIALIZED))
      {
         DBG("Initializing GLESv1 extensions...");
-        if (!_evgl_api_gles1_ext_init())
+        if (!_evgl_api_gles1_ext_init(getproc, glueexts))
           {
              ERR("GLESv1 extensions initialization failed");
              return;
@@ -821,16 +810,15 @@ evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs)
 }
 
 Eina_Bool
-_evgl_api_gles3_ext_init(void)
+_evgl_api_gles3_ext_init(void *getproc, const char *glueexts)
 {
-   if (_evgl_api_ext_status & 0x4)
-     return EINA_TRUE;
-
-#ifdef GL_GLES
-   Eina_Strbuf *sb = eina_strbuf_new();
+   const char *glexts;
+   fp_getproc gp = (fp_getproc)getproc;
    int _curext_supported = 0;
    Evas_GL_API *gles3_funcs;
-   const char *gles3_exts;
+   Eina_Strbuf *sb = eina_strbuf_new();
+
+#ifdef GL_GLES
    EVGL_Resource *rsc;
    EGLint context_version;
    EGLDisplay dpy = EGLDISPLAY_GET();
@@ -847,7 +835,7 @@ _evgl_api_gles3_ext_init(void)
 
    if ((dpy == EGL_NO_DISPLAY) || !rsc->current_ctx)
      {
-        DBG("Unable to initialize GLES3 extensions. Engine not initialised");
+        DBG("Unable to initialize GLES3 extensions. Engine not initialized");
         return EINA_FALSE;
      }
 
@@ -862,6 +850,7 @@ _evgl_api_gles3_ext_init(void)
         DBG("GLESv3 context not bound");
         return EINA_FALSE;
      }
+#endif
 
    gles3_funcs = _evgl_api_gles3_internal_get();
    if (!gles3_funcs || !gles3_funcs->glGetString)
@@ -870,8 +859,8 @@ _evgl_api_gles3_ext_init(void)
         return EINA_FALSE;
      }
 
-   gles3_exts = (const char *) gles3_funcs->glGetString(GL_EXTENSIONS);
-   if (!gles3_exts)
+   glexts = (const char *) gles3_funcs->glGetString(GL_EXTENSIONS);
+   if (!glexts)
      {
         ERR("GLESv3:glGetString(GL_EXTENSIONS) returned NULL!");
         return EINA_FALSE;
@@ -883,7 +872,7 @@ _evgl_api_gles3_ext_init(void)
 
    // Preparing all the magic macros
 #define GETPROCADDR(sym) \
-   ((__typeof__((*drvfunc))) (eglGetProcAddress(sym)))
+      (((!(*drvfunc)) && (gp)) ? (__typeof__((*drvfunc)))gp(sym) : 
(__typeof__((*drvfunc)))dlsym(RTLD_DEFAULT, sym))
 
 #define _EVASGL_EXT_BEGIN(name) \
    { \
@@ -894,7 +883,7 @@ _evgl_api_gles3_ext_init(void)
    }
 
 #define _EVASGL_EXT_CHECK_SUPPORT(name) \
-   (strstr(gles3_exts, name) != NULL)
+   ((strstr(glexts, name) != NULL) || (strstr(glueexts, name) != NULL))
 
 #define _EVASGL_EXT_DISCARD_SUPPORT() \
    *ext_support = 0;
@@ -1009,28 +998,17 @@ _evgl_api_gles3_ext_init(void)
      DBG("GLES3: List of supported extensions:\n%s", _gles3_ext_string);
 
    // GLESv3 version has been initialized!
-   _evgl_api_ext_status |= 0x4;
+   _evgl_api_ext_status |= EVASGL_API_GLES3_EXT_INITIALIZED;
    return EINA_TRUE;
-
-#else
-   ERR("GLES3 is not supported with GLX (yet)!");
-   return EINA_FALSE;
-#endif
 }
 
 void
-evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs)
+evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs, void *getproc, const char 
*glueexts)
 {
-   if (_evgl_api_ext_status < 1)
-     {
-        ERR("EVGL extension is not yet initialized.");
-        return;
-     }
-
-   if (!(_evgl_api_ext_status & 0x4))
+   if (!(_evgl_api_ext_status & EVASGL_API_GLES3_EXT_INITIALIZED))
      {
         DBG("Initializing GLESv3 extensions...");
-        if (!_evgl_api_gles3_ext_init())
+        if (!_evgl_api_gles3_ext_init(getproc, glueexts))
           {
              ERR("GLESv3 extensions initialization failed");
              return;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.h 
b/src/modules/evas/engines/gl_common/evas_gl_api_ext.h
index 2f10e4c..f61fe19 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.h
@@ -93,10 +93,9 @@
 #define EXTENSION_SUPPORT_GLES1(name) (_gles1_ext_support_##name == 1)
 #define EXTENSION_SUPPORT_GLES3(name) (_gles3_ext_support_##name == 1)
 
-extern Eina_Bool evgl_api_ext_init(void *getproc, const char *glueexts);
-extern void evgl_api_ext_get(Evas_GL_API *gl_funcs);
-extern void evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs);
-extern void evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs);
+extern void evgl_api_gles2_ext_get(Evas_GL_API *gl_funcs, void *getproc, const 
char *glueexts);
+extern void evgl_api_gles1_ext_get(Evas_GL_API *gl_funcs, void *getproc, const 
char *glueexts);
+extern void evgl_api_gles3_ext_get(Evas_GL_API *gl_funcs, void *getproc, const 
char *glueexts);
 extern const char *evgl_api_ext_string_get(Eina_Bool official, int version);
 
 #endif //_EVAS_GL_API_EXT_H
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h 
b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
index c176bba..09a9b75 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
@@ -724,6 +724,7 @@ _EVASGL_EXT_END()
 
 _EVASGL_EXT_BEGIN(framebuffer_object)
         _EVASGL_EXT_DRVNAME(GL_OES_framebuffer_object)
+        _EVASGL_EXT_DRVNAME(GL_ARB_framebuffer_object)
 
         _EVASGL_EXT_FUNCTION_BEGIN(GLboolean, glIsRenderbufferOES, (GLuint 
renderbuffer))
                 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glIsRenderbuffer")
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c 
b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
index 0d81392..9f09fb5 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
@@ -3863,8 +3863,6 @@ _evgl_gles1_api_init(void)
      }
 
    _evgl_load_gles1_apis(_gles1_handle, &_gles1_api);
-   if (!_evgl_api_gles1_ext_init())
-     WRN("Could not initialize OpenGL ES 1 extensions yet.");
 
    _initialized = EINA_TRUE;
    return EINA_TRUE;
@@ -4024,8 +4022,6 @@ _debug_gles1_api_get(Evas_GL_API *funcs)
    ORD(glVertexPointer);
    ORD(glViewport);
 #undef ORD
-
-   evgl_api_gles1_ext_get(funcs);
 }
 
 static void
@@ -4182,8 +4178,6 @@ _normal_gles1_api_get(Evas_GL_API *funcs)
    ORD(glVertexPointer);
    ORD(glViewport);
 #undef ORD
-
-   evgl_api_gles1_ext_get(funcs);
 }
 
 void
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 bd597df..8cccba8 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -10,8 +10,8 @@ typedef struct _GL_Format
 
 // Extended struct size based on the 314 functions found in gl31.h
 #define EVAS_GL_API_STRUCT_SIZE (sizeof(Evas_GL_API) + 300 * sizeof(void*))
-static Evas_GL_API *gl_funcs = NULL;
 static Evas_GL_API *gles1_funcs = NULL;
+static Evas_GL_API *gles2_funcs = NULL;
 static Evas_GL_API *gles3_funcs = NULL;
 
 EVGL_Engine *evgl_engine = NULL;
@@ -1600,22 +1600,6 @@ evgl_engine_init(void *eng_data, const EVGL_Interface 
*efunc)
 
    evgl_engine->safe_extensions = eina_hash_string_small_new(NULL);
 
-   // Initialize Extensions
-   if (efunc->proc_address_get && efunc->ext_string_get)
-     {
-        if (!evgl_api_ext_init(efunc->proc_address_get, 
efunc->ext_string_get(eng_data)))
-          {
-             ERR("Extensions failed to load. This shouldn't happen, Evas GL 
load fails.");
-             goto error;
-          }
-     }
-   else
-     ERR("Proc address get function not available. Extensions not 
initialized.");
-
-   if (efunc->ext_string_get)
-     DBG("GLUE Extension String: %s", efunc->ext_string_get(eng_data));
-   DBG("GL Extension String: %s", glGetString(GL_EXTENSIONS));
-
    // Surface Caps
    if (!_surface_cap_init(eng_data))
      {
@@ -1664,9 +1648,6 @@ evgl_engine_init(void *eng_data, const EVGL_Interface 
*efunc)
    // Maint Thread ID (get tid not available in eina thread yet)
    evgl_engine->main_tid = 0;
 
-   // Clear Function Pointers
-   if (!gl_funcs) gl_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
-
    return evgl_engine;
 
 error:
@@ -2263,7 +2244,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, 
EVGL_Context *ctx)
    // to use fbo & egl image passing to evas
    if (!ctx->extension_checked)
      {
-        if (!evgl_api_get(ctx->version))
+        if (!evgl_api_get(eng_data, ctx->version))
           {
              ERR("Unable to get the list of GL APIs for version %d", 
ctx->version);
              evas_gl_common_error_set(eng_data, EVAS_GL_NOT_INITIALIZED);
@@ -2388,8 +2369,10 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, 
EVGL_Context *ctx)
    else
      {
         Eina_Bool use_extension = EINA_FALSE;
+#ifdef GL_GLES
         if ((ctx->version == EVAS_GL_GLES_1_X) && (gles1_funcs))
           use_extension = EINA_TRUE;
+#endif
 
         // Normal FBO Rendering
         // Create FBO if it hasn't been created
@@ -2730,30 +2713,33 @@ evgl_get_pixels_post(void)
 }
 
 Evas_GL_API *
-evgl_api_get(Evas_GL_Context_Version version)
+evgl_api_get(void *eng_data, Evas_GL_Context_Version version)
 {
    if (version == EVAS_GL_GLES_2_X)
      {
-        _evgl_api_get(gl_funcs, evgl_engine->api_debug_mode);
-        return gl_funcs;
+        if (!gles2_funcs) gles2_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
+
+        _evgl_api_gles2_get(gles2_funcs, evgl_engine->api_debug_mode);
+        evgl_api_gles2_ext_get(gles2_funcs, 
evgl_engine->funcs->proc_address_get, 
evgl_engine->funcs->ext_string_get(eng_data));
+
+        return gles2_funcs;
      }
    else if (version == EVAS_GL_GLES_1_X)
      {
         if (!gles1_funcs) gles1_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
 
         _evgl_api_gles1_get(gles1_funcs, evgl_engine->api_debug_mode);
+        evgl_api_gles1_ext_get(gles1_funcs, 
evgl_engine->funcs->proc_address_get, 
evgl_engine->funcs->ext_string_get(eng_data));
+
         return gles1_funcs;
      }
    else if (version == EVAS_GL_GLES_3_X)
      {
-        // Allocate gles3 funcs here, as this is called only if GLES_3 is 
supported
         if (!gles3_funcs) gles3_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
 
-        if (!_evgl_api_gles3_get(gles3_funcs, evgl_engine->api_debug_mode))
-          {
-             free(gles3_funcs);
-             gles3_funcs = NULL;
-          }
+        _evgl_api_gles3_get(gles3_funcs, evgl_engine->api_debug_mode);
+        evgl_api_gles3_ext_get(gles3_funcs, 
evgl_engine->funcs->proc_address_get, 
evgl_engine->funcs->ext_string_get(eng_data));
+
         return gles3_funcs;
      }
    else return NULL;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h 
b/src/modules/evas/engines/gl_common/evas_gl_core.h
index 9f34df6..3e4fda8 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -63,7 +63,7 @@ int          evgl_make_current(void *eng_data, EVGL_Surface 
*sfc, EVGL_Context *
 
 const char  *evgl_string_query(int name);
 int          evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface 
*ns);
-Evas_GL_API *evgl_api_get(Evas_GL_Context_Version version);
+Evas_GL_API *evgl_api_get(void *eng_data, Evas_GL_Context_Version version);
 void         evgl_safe_extension_add(const char *name, void *funcptr);
 Eina_Bool    evgl_safe_extension_get(const char *name, void **pfuncptr);
 
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h 
b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
index 0a3d20e..e87c477 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
@@ -336,9 +336,9 @@ struct _EVGL_Engine
 extern EVGL_Engine   *evgl_engine;
 
 // Internally used functions
-extern void           _evgl_api_get(Evas_GL_API *api, int debug);
+extern void           _evgl_api_gles2_get(Evas_GL_API *api, Eina_Bool debug);
 extern void           _evgl_api_gles1_get(Evas_GL_API *api, Eina_Bool debug);
-extern Eina_Bool      _evgl_api_gles3_get(Evas_GL_API *api, Eina_Bool debug);
+extern void           _evgl_api_gles3_get(Evas_GL_API *api, Eina_Bool debug);
 extern EVGL_Resource *_evgl_tls_resource_get(void);
 extern EVGL_Resource *_evgl_tls_resource_create(void *data);
 extern void           _evgl_tls_resource_destroy(void *data);
@@ -346,7 +346,9 @@ extern EVGL_Context  *_evgl_current_context_get(void);
 extern int            _evgl_not_in_pixel_get(void);
 extern int            _evgl_direct_enabled(void);
 extern EVGLNative_Context _evgl_native_context_get(Evas_GL_Context *ctx);
-Eina_Bool             _evgl_api_gles1_ext_init(void);
+Eina_Bool             _evgl_api_gles2_ext_init(void *getproc, const char 
*glueexts);
+Eina_Bool             _evgl_api_gles1_ext_init(void *getproc, const char 
*glueexts);
+Eina_Bool             _evgl_api_gles3_ext_init(void *getproc, const char 
*glueexts);
 Evas_GL_API*          _evgl_api_gles1_internal_get(void);
 Evas_GL_API*          _evgl_api_gles3_internal_get(void);
 
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c 
b/src/modules/evas/engines/gl_generic/evas_engine.c
index 63fe2d8..9012ba1 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1532,7 +1532,7 @@ eng_gl_api_get(void *data, int version)
         ERR("Version not supported!");
         return NULL;
      }
-   ret = evgl_api_get(version);
+   ret = evgl_api_get(data, version);
 
    //Disable GLES3 support if symbols not present
    if ((!ret) && (version == EVAS_GL_GLES_3_X))
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index efe9e3f..63f2eeb 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -540,13 +540,6 @@ evgl_eng_context_create(void *data, void *share_ctx, 
Evas_GL_Context_Version ver
                                    (GLXContext)share_ctx,
                                    1);
      }
-   else if ((version == EVAS_GL_GLES_1_X) || (version == EVAS_GL_GLES_3_X))
-     {
-        context = glXCreateContext(eng_get_ob(re)->info->info.display,
-                                   eng_get_ob(re)->visualinfo,
-                                   NULL,
-                                   1);
-     }
    else
      {
         context = glXCreateContext(eng_get_ob(re)->info->info.display,

-- 


Reply via email to