Skip to content

Commit

Permalink
egl: Don't use SDL_LoadFunction to get GL entry points on Emscripten.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed Mar 20, 2020
1 parent f7c9502 commit 90f9e8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/video/SDL_egl.c
Expand Up @@ -231,6 +231,7 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc)
retval = _this->egl_data->eglGetProcAddress(proc);
}

#ifndef __EMSCRIPTEN__ /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */
/* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */
if (!retval) {
static char procname[64];
Expand All @@ -242,8 +243,9 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc)
retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname);
}
}
#endif

/* Try eglGetProcAddress if we on <= 1.4 and still searching... */
/* Try eglGetProcAddress if we're on <= 1.4 and still searching... */
if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) {
retval = _this->egl_data->eglGetProcAddress(proc);
if (retval) {
Expand Down

0 comments on commit 90f9e8f

Please sign in to comment.