]> git.cworth.org Git - apitrace/commitdiff
Always try dlsym before get eglGetProcAddress
authorKan-Ru Chen <kanru@kanru.info>
Thu, 10 Nov 2011 02:57:04 +0000 (10:57 +0800)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 27 Nov 2011 12:45:21 +0000 (12:45 +0000)
Some implementation could return garbage from eglGetProcAddress

egltrace.py
glproc.py

index 994c1ee88a0750e5d29fa1d5c823a9f7f462efa6..1148924d7e58447adcb80a2526ca1d26abc1ab7d 100644 (file)
@@ -115,24 +115,17 @@ if __name__ == '__main__':
 /*
  * Lookup a EGL or GLES symbol
  */
-void * __libegl_sym(const char *symbol, bool pub)
+void * __libegl_sym(const char *symbol)
 {
     void *proc;
 
-    /*
-     * Public symbols are EGL core functions and those defined in dekstop GL
-     * ABI.  Troubles come from the latter.
+    /* Always try dlsym before eglGetProcAddress as spec 3.10 says
+     * implementation may choose to also export extension functions
+     * publicly.
      */
-    if (pub) {
-        proc = dlsym(RTLD_NEXT, symbol);
-        if (!proc && symbol[0] == 'g' && symbol[1] == 'l')
-            proc = (void *) __eglGetProcAddress(symbol);
-    }
-    else {
+    proc = dlsym(RTLD_NEXT, symbol);
+    if (!proc && symbol[0] == 'g' && symbol[1] == 'l')
         proc = (void *) __eglGetProcAddress(symbol);
-        if (!proc && symbol[0] == 'g' && symbol[1] == 'l')
-            proc = dlsym(RTLD_NEXT, symbol);
-    }
 
     return proc;
 }
index a2452579bbbcd0d3ebec38e077174769a31ff88f..67079e45623de2e2b0bb41dac30a20b605d66874 100644 (file)
--- a/glproc.py
+++ b/glproc.py
@@ -505,9 +505,9 @@ class GlDispatcher(Dispatcher):
         print '#  endif'
         print '#else /* !RETRACE */'
         print '#  if defined(TRACE_EGL)'
-        print '#    define __getPublicProcAddress(name) __libegl_sym(name, true)'
-        print '#    define __getPrivateProcAddress(name) __libegl_sym(name, false)'
-        print '     void * __libegl_sym(const char *symbol, bool pub);'
+        print '#    define __getPublicProcAddress(name) __libegl_sym(name)'
+        print '#    define __getPrivateProcAddress(name) __libegl_sym(name)'
+        print '     void * __libegl_sym(const char *symbol);'
         print '#  elif defined(_WIN32)'
         print '     PROC __getPublicProcAddress(LPCSTR lpProcName);'
         print '#    define __getPrivateProcAddress(name) __wglGetProcAddress(name)'