Add support for looking up GLES3 functions using dlsym().

ARM and Mesa disagreed on how to look up the functions, so support
both ways.

Fixes #21
macos/v1.5.9
Eric Anholt 11 years ago
parent 053ac5f457
commit 14f24485e3
  1. 23
      src/dispatch_common.c
  2. 1
      src/dispatch_common.h

@ -207,7 +207,7 @@ do_dlsym(void **handle, const char *lib_name, const char *name,
#else #else
result = dlsym(*handle, name); result = dlsym(*handle, name);
#endif #endif
if (!result) { if (!result && exit_on_fail) {
fprintf(stderr,"%s() not found in %s\n", name, lib_name); fprintf(stderr,"%s() not found in %s\n", name, lib_name);
exit(1); exit(1);
} }
@ -381,6 +381,27 @@ epoxy_gles2_dlsym(const char *name)
return do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, true); return do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, true);
} }
/**
* Does the appropriate dlsym() or eglGetProcAddress() for GLES3
* functions.
*
* Mesa interpreted GLES as intending that the GLES3 functions were
* available only through eglGetProcAddress() and not dlsym(), while
* ARM's Mali drivers interpreted GLES as intending that GLES3
* functions were available only through dlsym() and not
* eglGetProcAddress(). Thanks, Khronos.
*/
void *
epoxy_gles3_dlsym(const char *name)
{
void *func = do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, false);
if (func)
return func;
return epoxy_get_proc_address(name);
}
/** /**
* Performs either the dlsym or glXGetProcAddress()-equivalent for * Performs either the dlsym or glXGetProcAddress()-equivalent for
* core functions in desktop GL. * core functions in desktop GL.

@ -78,6 +78,7 @@ void *epoxy_glx_dlsym(const char *name);
void *epoxy_gl_dlsym(const char *name); void *epoxy_gl_dlsym(const char *name);
void *epoxy_gles1_dlsym(const char *name); void *epoxy_gles1_dlsym(const char *name);
void *epoxy_gles2_dlsym(const char *name); void *epoxy_gles2_dlsym(const char *name);
void *epoxy_gles3_dlsym(const char *name);
void *epoxy_get_proc_address(const char *name); void *epoxy_get_proc_address(const char *name);
void *epoxy_get_core_proc_address(const char *name, int core_version); void *epoxy_get_core_proc_address(const char *name, int core_version);
void *epoxy_get_bootstrap_proc_address(const char *name); void *epoxy_get_bootstrap_proc_address(const char *name);

Loading…
Cancel
Save