diff options
author | José Fonseca <jfonseca@vmware.com> | 2015-01-02 15:03:13 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2015-01-02 15:03:13 +0000 |
commit | 99cac771d659064e41dce01129e9ed51ba19a4f5 (patch) | |
tree | eeb1a5d9c7140890b6d3c94fd37afce31cfda375 /dispatch | |
parent | a1bdb1c2d86bc4c4539b3e30613ae0e1e9db9787 (diff) |
egltrace: Cope with EGL_KHR_get_all_proc_addresses better.
More detailed explanation in the code.
Fixes #301.
Diffstat (limited to 'dispatch')
-rw-r--r-- | dispatch/glproc_egl.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/dispatch/glproc_egl.cpp b/dispatch/glproc_egl.cpp index abba7275..c1331275 100644 --- a/dispatch/glproc_egl.cpp +++ b/dispatch/glproc_egl.cpp @@ -116,7 +116,32 @@ _getPublicProcAddress(const char *procName) return NULL; #else - return dlsym(RTLD_NEXT, procName); + void *proc; + proc = dlsym(RTLD_NEXT, procName); + if (!proc && + strcmp(procName, "eglGetProcAddress") != 0) { + /* + * This might happen when: + * + * - the application is querying non-extensions functions via + * eglGetProcAddress (either because EGL_KHR_get_all_proc_addresses + * is advertised, or merely because the EGL implementation supports + * it regardless, like Mesa does) + * + * - libGLES*.so nor libGL*.so was ever loaded. + * + * - we need to resolve entrypoints that application never asked (e.g., + * glGetIntegerv), for internal purposes + * + * Therefore, we try to fallback to eglGetProcAddress. + * + * Another alternative would be to dlopen libGL/libGLES ourselves. + * + * See https://github.com/apitrace/apitrace/issues/301#issuecomment-68532248 + */ + proc = (void *) _eglGetProcAddress(procName); + } + return proc; #endif } |