Merge pull request #27 from Sonicadvance1/Android-Support

Add support for Android.
macos/v1.5.9
Eric Anholt 11 years ago
commit 4d64234e05
  1. 32
      src/dispatch_common.c
  2. 5
      src/dispatch_common.h

@ -104,10 +104,22 @@
#ifdef __APPLE__
#define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
#elif defined(ANDROID)
#define GLX_LIB "libGLESv2.so"
#else
#define GLX_LIB "libGL.so.1"
#endif
#ifdef ANDROID
#define EGL_LIB "libEGL.so"
#define GLES1_LIB "libGLESv1_CM.so"
#define GLES2_LIB "libGLESv2.so"
#else
#define EGL_LIB "libEGL.so.1"
#define GLES1_LIB "libGLESv1_CM.so.1"
#define GLES2_LIB "libGLESv2.so.2"
#endif
struct api {
#ifndef _WIN32
/**
@ -380,7 +392,7 @@ epoxy_current_context_is_glx(void)
return true;
#if PLATFORM_HAS_EGL
sym = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetCurrentContext",
sym = do_dlsym(&api.egl_handle, EGL_LIB, "eglGetCurrentContext",
false);
if (sym && epoxy_egl_get_current_gl_context_api() != EGL_NONE)
return false;
@ -416,7 +428,7 @@ epoxy_conservative_has_gl_extension(const char *ext)
void *
epoxy_egl_dlsym(const char *name)
{
return do_dlsym(&api.egl_handle, "libEGL.so.1", name, true);
return do_dlsym(&api.egl_handle, EGL_LIB, name, true);
}
void *
@ -446,7 +458,7 @@ epoxy_gles1_dlsym(const char *name)
if (epoxy_current_context_is_glx()) {
return epoxy_get_proc_address(name);
} else {
return do_dlsym(&api.gles1_handle, "libGLESv1_CM.so.1", name, true);
return do_dlsym(&api.gles1_handle, GLES1_LIB, name, true);
}
}
@ -456,7 +468,7 @@ epoxy_gles2_dlsym(const char *name)
if (epoxy_current_context_is_glx()) {
return epoxy_get_proc_address(name);
} else {
return do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, true);
return do_dlsym(&api.gles2_handle, GLES2_LIB, name, true);
}
}
@ -476,7 +488,7 @@ epoxy_gles3_dlsym(const char *name)
if (epoxy_current_context_is_glx()) {
return epoxy_get_proc_address(name);
} else {
void *func = do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, false);
void *func = do_dlsym(&api.gles2_handle, GLES2_LIB, name, false);
if (func)
return func;
@ -494,6 +506,12 @@ epoxy_get_core_proc_address(const char *name, int core_version)
{
#ifdef _WIN32
int core_symbol_support = 10;
#elif defined(ANDROID)
/**
* All symbols must be resolved through eglGetProcAddress
* on Android
*/
int core_symbol_support = 0;
#else
int core_symbol_support = 12;
#endif
@ -564,7 +582,7 @@ epoxy_get_bootstrap_proc_address(const char *name)
* non-X11 ES2 context from loading a bunch of X11 junk).
*/
#if PLATFORM_HAS_EGL
get_dlopen_handle(&api.egl_handle, "libEGL.so.1", false);
get_dlopen_handle(&api.egl_handle, EGL_LIB, false);
if (api.egl_handle) {
switch (epoxy_egl_get_current_gl_context_api()) {
case EGL_OPENGL_API:
@ -575,7 +593,7 @@ epoxy_get_bootstrap_proc_address(const char *name)
* us. Try the GLES2 implementation first, and fall back
* to GLES1 otherwise.
*/
get_dlopen_handle(&api.gles2_handle, "libGLESv2.so.2", false);
get_dlopen_handle(&api.gles2_handle, GLES2_LIB, false);
if (api.gles2_handle)
return epoxy_gles2_dlsym(name);
else

@ -33,6 +33,11 @@
#define PLATFORM_HAS_GLX 1
#define PLATFORM_HAS_WGL 0
#define EPOXY_IMPORTEXPORT
#elif defined(ANDROID)
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 0
#define EPOXY_IMPORTEXPORT
#else
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 1

Loading…
Cancel
Save