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.
This commit is contained in:
Derek Foreman 2017-07-19 12:00:07 -05:00
parent 86377caa0e
commit c7fe083a57
3 changed files with 17 additions and 5 deletions

View 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);

View 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)
{

View 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);