diff options
| author | Chad Versace <chad.versace@intel.com> | 2015-04-29 18:08:17 -0700 |
|---|---|---|
| committer | Chad Versace <chad.versace@intel.com> | 2015-04-30 11:00:07 -0700 |
| commit | 845ba0e4dfb9372307f5d3032abdd0860e76731b (patch) | |
| tree | 1e233056c34e5d2cc9755702913f7d2dac8f2cf3 | |
| parent | 4d08b368678494cdb4fa487f3461e7cfa9490ae7 (diff) | |
dispatch: Fix lookup for core OpenGL symbols
The following commit regressed lookup of some new OpenGL symbols:
commit cb334db3f2bb7ddf9b2f43641f898896f99c69b1
Author: Daniel Kurtz <djkurtz@chromium.org>
Date: Thu Oct 16 21:36:01 2014 +0800
Subject: dispatch: Use dlsym to lookup core symbols for EGL (v2)
It regressed these Piglit tests on i965:
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-vert_adj
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-geom
Fix the tests by consistently using egl/glXGetProcAddress to lookup core
OpenGL symbols instead of dlsym(), and add a lengthy comment explaining
why. (For core OpenGL ES symbols, continue using dlsym() as in
cb334db3).
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
| -rw-r--r-- | tests/util/piglit-dispatch-init.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/tests/util/piglit-dispatch-init.c b/tests/util/piglit-dispatch-init.c index a47d4cc6e..1aae2bee6 100644 --- a/tests/util/piglit-dispatch-init.c +++ b/tests/util/piglit-dispatch-init.c @@ -157,13 +157,9 @@ get_core_proc_address(const char *function_name, int gl_10x_version) #else /* Linux */ #if defined(PIGLIT_HAS_EGL) -#define GLX_LIB "libGL.so.1" #define GLES1_LIB "libGLESv1_CM.so.1" #define GLES2_LIB "libGLESv2.so.2" -/** dlopen() return value for libGL.so.1 */ -static void *glx_handle; - /** dlopen() return value for libGLESv1_CM.so.1 */ static void *gles1_handle; @@ -213,11 +209,32 @@ get_ext_proc_address(const char *function_name) * This function is used to retrieve the address of core GL functions * on Linux. * - * eglGetProcAddress supports querying core functions only if EGL >= 1.5 - * or if EGL_KHR_get_all_proc_addresses or - * EGL_KHR_client_get_all_proc_addresses is supported. Rather than worry - * about such details, when using EGL we consistently use dlsym() on the - * client library to lookup core functions. + * eglGetProcAddress supports querying core functions only if EGL >= 1.5 or if + * EGL_KHR_get_all_proc_addresses or EGL_KHR_client_get_all_proc_addresses is + * supported. Rather than worry about such details, we consistently use dlysm() + * to lookup core *OpenGL ES* functions on systems where EGL is available. + * + * Lookup for core *OpenGL* functions is more complicated because the EGL 1.4 + * specification, the antiquated OpenGL ABI for Linux [1] from year 2000, and + * various libGL.so implementations all disagree on the set of symbols that + * libGL.so should statically expose and which are queryable with + * eglGetProcAddress. The EGL 1.4 spec (as explained above) does not require + * eglGetProcAddress to work for core functions. The OpenGL ABI spec requires + * that libGL.so expose *no* symbols statically except those contained in GL + * 1.2 and select extensions. Actual driver vendors tend to expose most, if + * not all, symbols statically from libGL.so. + * + * Considering how messy this situation is, the best way to query a core OpenGL + * function on EGL is eglGetProcAddress (or even glXGetProcAddress!). Sometimes + * Mesa's libGL doesn't statically expose all OpenGL functions supported by the + * driver, but Mesa's eglGetProcAddress does work for all GL functions, core + * and extension. Some other vendors of desktop OpenGL drivers, such as + * Nvidia, do the same. (By coincidence, Mesa's glXGetProcAddress also returns + * the same addresses as eglGetProcAddress). We don't need to worry about + * platforms on which eglGetProcAddress does not work for core functions, such + * as Mali, because those platforms support only OpenGL ES. + * + * [1] https://www.opengl.org/registry/ABI/ */ static piglit_dispatch_function_ptr get_core_proc_address(const char *function_name, int gl_10x_version) @@ -230,8 +247,11 @@ get_core_proc_address(const char *function_name, int gl_10x_version) return do_dlsym(&gles2_handle, GLES2_LIB, function_name); case 10: default: - /* GL does not have its own library, so use GLX */ - return do_dlsym(&glx_handle, GLX_LIB, function_name); + /* We query the address of core OpenGL functions as if they + * were extension functions. Read about the gory details + * above. */ + (void) gl_10x_version; + return get_ext_proc_address(function_name); } #else /* We don't need to worry about the GL version, since when using GLX |
