wayland_egl: Defer gl symbol lookups until they're possible
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 19 Jul 2017 17:00:07 +0000 (12:00 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Wed, 19 Jul 2017 17:00:07 +0000 (12:00 -0500)
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
src/modules/evas/engines/wayland_egl/evas_engine.h
src/modules/evas/engines/wayland_egl/evas_wl_main.c

index db2e3c6..1c90a5b 100644 (file)
@@ -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);
index f5762f5..3d88285 100644 (file)
@@ -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)
 {
index b12f555..36a3c81 100644 (file)
@@ -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);