summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-03-17 11:17:19 -0700
committerEric Anholt <eric@anholt.net>2014-03-17 11:20:10 -0700
commit14f24485e33816139398d1bd170d617703473738 (patch)
treef4198cef0b74cd26b98f3349df16f8f5f8f215e1 /src
parent053ac5f45780ed82eeaffa457353e6c25593bef3 (diff)
downloadlibepoxy-14f24485e33816139398d1bd170d617703473738.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/dispatch_common.c23
-rw-r--r--src/dispatch_common.h1
2 files changed, 23 insertions, 1 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index dce2601..f6d69e0 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -207,7 +207,7 @@ do_dlsym(void **handle, const char *lib_name, const char *name,
#else
result = dlsym(*handle, name);
#endif
- if (!result) {
+ if (!result && exit_on_fail) {
fprintf(stderr,"%s() not found in %s\n", name, lib_name);
exit(1);
}
@@ -382,6 +382,27 @@ epoxy_gles2_dlsym(const char *name)
}
/**
+ * 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
* core functions in desktop GL.
*/
diff --git a/src/dispatch_common.h b/src/dispatch_common.h
index a70753a..a0722ff 100644
--- a/src/dispatch_common.h
+++ b/src/dispatch_common.h
@@ -78,6 +78,7 @@ void *epoxy_glx_dlsym(const char *name);
void *epoxy_gl_dlsym(const char *name);
void *epoxy_gles1_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_core_proc_address(const char *name, int core_version);
void *epoxy_get_bootstrap_proc_address(const char *name);