derekf pushed a commit to branch master.

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

commit c7fe083a57c7047b2752592545e419e60b1adfd9
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Wed Jul 19 12:00:07 2017 -0500

    wayland_egl: Defer gl symbol lookups until they're possible
    
    Commit 2e6587a14b adds a gl extension string to glsym_evas_gl_symbols()
    to prevent using functions that are provided by extensions that aren't
    available in the current gl context.
    
    However, we can't query the extension strings until after we create an egl
    context.
    
    Split the regular symbol lookup stuff from the gl symbol lookup stuff so
    we can query at the appropriate time.
---
 src/modules/evas/engines/wayland_egl/evas_engine.c  | 18 +++++++++++++-----
 src/modules/evas/engines/wayland_egl/evas_engine.h  |  2 ++
 src/modules/evas/engines/wayland_egl/evas_wl_main.c |  2 ++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c 
b/src/modules/evas/engines/wayland_egl/evas_engine.c
index db2e3c6c88..1c90a5b6fd 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -90,10 +90,9 @@ eng_get_ob(Render_Engine *re)
 }
 
 static void
-gl_symbols(void)
+symbols(void)
 {
    static Eina_Bool done = EINA_FALSE;
-   const char *exts = NULL;
 
    if (done) return;
 
@@ -137,6 +136,16 @@ gl_symbols(void)
    LINK2GENERIC(evas_gl_common_eglCreateImage);
    LINK2GENERIC(evas_gl_common_eglDestroyImage);
 
+   done = EINA_TRUE;
+}
+
+void
+eng_gl_symbols(EGLDisplay edsp)
+{
+   static Eina_Bool done = EINA_FALSE;
+   const char *exts = NULL;
+
+   if (done) return;
 #define FINDSYM(dst, sym, typ) \
    if (glsym_eglGetProcAddress) { \
       if (!dst) dst = (typ)glsym_eglGetProcAddress(sym); \
@@ -146,8 +155,7 @@ gl_symbols(void)
 
    // Find EGL extensions
    // FIXME: whgen above eglGetDisplay() is fixed... fix the below...
-//   exts = eglQueryString(ob->egl_disp, EGL_EXTENSIONS);
-
+   exts = eglQueryString(edsp, EGL_EXTENSIONS);
    // Find GL extensions
    glsym_evas_gl_symbols(glsym_eglGetProcAddress, exts);
 
@@ -1455,7 +1463,7 @@ module_open(Evas_Module *em)
    ORD(image_native_init);
    ORD(image_native_shutdown);
 
-   gl_symbols();
+   symbols();
 
    /* advertise out which functions we support */
    em->functions = (void *)(&func);
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.h 
b/src/modules/evas/engines/wayland_egl/evas_engine.h
index f5762f5b91..3d88285b1e 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.h
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.h
@@ -131,6 +131,8 @@ Context_3D *eng_gl_context_new(Outbuf *win);
 void eng_gl_context_free(Context_3D *context);
 void eng_gl_context_use(Context_3D *context);
 
+void eng_gl_symbols(EGLDisplay disp);
+
 static inline int 
 _re_wincheck(Outbuf *ob)
 {
diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c 
b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
index b12f5558a6..36a3c81ab6 100644
--- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c
+++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
@@ -168,6 +168,8 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int 
h, Render_Engine_Swap
         return NULL;
      }
 
+   eng_gl_symbols(gw->egl_disp);
+
    if (!(gw->gl_context = glsym_evas_gl_common_context_new()))
      {
         eng_window_free(gw);

-- 


Reply via email to