From: Kan-Ru Chen Date: Thu, 10 Nov 2011 02:57:04 +0000 (+0800) Subject: Always try dlsym before get eglGetProcAddress X-Git-Tag: 2.0_alpha^2~455 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e64ba4980c20ba52f6b3a88bc817623052e6d0a8;p=tools%2Fapitrace.git Always try dlsym before get eglGetProcAddress Some implementation could return garbage from eglGetProcAddress --- diff --git a/egltrace.py b/egltrace.py index 994c1ee..1148924 100644 --- a/egltrace.py +++ b/egltrace.py @@ -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; } diff --git a/glproc.py b/glproc.py index a245257..67079e4 100644 --- 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)'