Make sure to fetch egl functions via eglGPA if necessary. Refs #2494

* Extensions will likely not be exported as real symbols, so we need to handle
  the case of needing to fetch the onward pointer via eglGetProcAddress.
* We do this for non-extensions too, to try to fetch core functions that are
  still NULL after hook initialisation. Since we do wholesale dlopen/dlsym
  replacement on linux we cannot handle the case where an application checks for
  function validity via just normal dlsym returning something, but then the
  function doesn't exist in the real libEGL.so. We have no way of reporting that
  the function actually doesn't exist because we have nowhere to call, and it
  will crash. Trying to fetch the pointer via eglGPA is unlikely to succeed but
  should do no harm as we don't set these function pointers anywhere else.
This commit is contained in:
baldurk
2022-02-14 11:57:49 +00:00
parent 755c4254b8
commit 9b9a67e8da
+8
View File
@@ -910,6 +910,14 @@ static void EGLHooked(void *handle)
EGL_NONHOOKED_SYMBOLS(EGL_FETCH)
#undef EGL_FETCH
// fetch any hooked extension functions into our dispatch table since they're not necessarily
// exported
#define EGL_FETCH(func, isext, replayrequired) \
if(!EGL.func) \
EGL.func = (CONCAT(PFN_egl, func))EGL.GetProcAddress("egl" STRINGIZE(func));
EGL_HOOKED_SYMBOLS(EGL_FETCH)
#undef EGL_FETCH
// on systems where EGL isn't the primary/only way to get GL function pointers, we need to ensure we
// re-fetch all function pointers through eglGetProcAddress and don't try to use any through the
// primary system library (opengl32.dll/libGL.so), since they may not work correctly.