egl: Don't use SDL_LoadFunction to get GL entry points on Emscripten.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 20 Mar 2020 15:13:09 -0400
changeset 1364900ee90243d11
parent 13648 1631ba283bc4
child 13650 82e1e144c03b
egl: Don't use SDL_LoadFunction to get GL entry points on Emscripten.

This results in a dlsym() call, which causes Emscripten to panic if the game
wasn't explicitly built dlopen support. eglGetProcAddress works just fine on
this platform, so just let that codepath handle it.
src/video/SDL_egl.c
     1.1 --- a/src/video/SDL_egl.c	Fri Mar 20 12:13:26 2020 -0700
     1.2 +++ b/src/video/SDL_egl.c	Fri Mar 20 15:13:09 2020 -0400
     1.3 @@ -231,6 +231,7 @@
     1.4          retval = _this->egl_data->eglGetProcAddress(proc);
     1.5      }
     1.6  
     1.7 +    #ifndef __EMSCRIPTEN__  /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */
     1.8      /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */
     1.9      if (!retval) {
    1.10          static char procname[64];
    1.11 @@ -242,8 +243,9 @@
    1.12              retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname);
    1.13          }
    1.14      }
    1.15 +    #endif
    1.16  
    1.17 -    /* Try eglGetProcAddress if we on <= 1.4 and still searching... */
    1.18 +    /* Try eglGetProcAddress if we're on <= 1.4 and still searching... */
    1.19      if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) {
    1.20          retval = _this->egl_data->eglGetProcAddress(proc);
    1.21          if (retval) {