Loading opengl/libagl/egl.cpp +43 −25 Original line number Diff line number Diff line Loading @@ -478,22 +478,38 @@ struct extention_map_t { }; static const extention_map_t gExtentionMap[] = { { "glDrawTexsOES", (void(*)())&glDrawTexsOES }, { "glDrawTexiOES", (void(*)())&glDrawTexiOES }, { "glDrawTexfOES", (void(*)())&glDrawTexfOES }, { "glDrawTexxOES", (void(*)())&glDrawTexxOES }, { "glDrawTexsvOES", (void(*)())&glDrawTexsvOES }, { "glDrawTexivOES", (void(*)())&glDrawTexivOES }, { "glDrawTexfvOES", (void(*)())&glDrawTexfvOES }, { "glDrawTexxvOES", (void(*)())&glDrawTexxvOES }, { "glQueryMatrixxOES", (void(*)())&glQueryMatrixxOES }, { "glClipPlanef", (void(*)())&glClipPlanef }, { "glClipPlanex", (void(*)())&glClipPlanex }, { "glBindBuffer", (void(*)())&glBindBuffer }, { "glBufferData", (void(*)())&glBufferData }, { "glBufferSubData", (void(*)())&glBufferSubData }, { "glDeleteBuffers", (void(*)())&glDeleteBuffers }, { "glGenBuffers", (void(*)())&glGenBuffers }, { "glDrawTexsOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES }, { "glDrawTexiOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES }, { "glDrawTexfOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES }, { "glDrawTexxOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES }, { "glDrawTexsvOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES }, { "glDrawTexivOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES }, { "glDrawTexfvOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES }, { "glDrawTexxvOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES }, { "glQueryMatrixxOES", (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES }, { "glClipPlanef", (__eglMustCastToProperFunctionPointerType)&glClipPlanef }, { "glClipPlanex", (__eglMustCastToProperFunctionPointerType)&glClipPlanex }, { "glBindBuffer", (__eglMustCastToProperFunctionPointerType)&glBindBuffer }, { "glBufferData", (__eglMustCastToProperFunctionPointerType)&glBufferData }, { "glBufferSubData", (__eglMustCastToProperFunctionPointerType)&glBufferSubData }, { "glDeleteBuffers", (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers }, { "glGenBuffers", (__eglMustCastToProperFunctionPointerType)&glGenBuffers }, }; /* Loading Loading @@ -1299,6 +1315,8 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, } } // TODO: call connect / disconnect on the surface ogles_context_t* gl = (ogles_context_t*)ctx; if (makeCurrent(gl) == 0) { if (ctx) { Loading opengl/libs/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ GLES_CM/gl.cpp.arm \ GLES_CM/gl_logger.cpp \ # LOCAL_SHARED_LIBRARIES += libcutils libutils libui libEGL Loading opengl/libs/EGL/egl.cpp +90 −48 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ ** limitations under the License. */ #define LOG_TAG "GLLogger" #define LOG_TAG "libEGL" #include <ctype.h> #include <string.h> Loading Loading @@ -69,9 +69,9 @@ private: struct egl_display_t : public egl_object_t<'_dpy'> { EGLDisplay dpys[2]; EGLConfig* configs[2]; EGLint numConfigs[2]; EGLDisplay dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; EGLConfig* configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; EGLint numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; EGLint numTotalConfigs; char const* extensionsString; volatile int32_t refs; Loading @@ -81,7 +81,7 @@ struct egl_display_t : public egl_object_t<'_dpy'> char const * clientApi; char const * extensions; }; strings_t queryString[2]; strings_t queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; }; struct egl_surface_t : public egl_object_t<'_srf'> Loading Loading @@ -156,7 +156,7 @@ static char const * const egl_names[] = { // ---------------------------------------------------------------------------- egl_connection_t gEGLImpl[2]; egl_connection_t gEGLImpl[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; static egl_display_t gDisplay[NUM_DISPLAYS]; static pthread_mutex_t gThreadLocalStorageKeyMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_key_t gEGLThreadLocalStorageKey = -1; Loading Loading @@ -278,29 +278,56 @@ void *load_driver(const char* driver, gl_hooks_t* hooks) driver, dlerror()); if (dso) { void** curr; // first find the symbol for eglGetProcAddress typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)( const char*); getProcAddressType getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress"); LOGE_IF(!getProcAddress, "can't find eglGetProcAddress() in %s", driver); __eglMustCastToProperFunctionPointerType* curr; char const * const * api; gl_hooks_t::gl_t* gl = &hooks->gl; curr = (void**)gl; api = gl_names; gl_hooks_t::egl_t* egl = &hooks->egl; curr = (__eglMustCastToProperFunctionPointerType*)egl; api = egl_names; while (*api) { void* f = dlsym(dso, *api); //LOGD("<%s> @ 0x%p", *api, f); char const * name = *api; __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { //LOGW("<%s> not found in %s", *api, driver); f = (void*)gl_unimplemented; // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); if (f == NULL) { f = (__eglMustCastToProperFunctionPointerType)0; } } *curr++ = f; api++; } gl_hooks_t::egl_t* egl = &hooks->egl; curr = (void**)egl; api = egl_names; gl_hooks_t::gl_t* gl = &hooks->gl; curr = (__eglMustCastToProperFunctionPointerType*)gl; api = gl_names; while (*api) { void* f = dlsym(dso, *api); char const * name = *api; // if the function starts with '__' it's a special case that // uses a wrapper. skip the '__' when looking into the real lib. if (name[0] == '_' && name[1] == '_') { name += 2; } __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); if (f == NULL) { //LOGW("<%s> not found in %s", *api, driver); f = (void*)0; f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; } } *curr++ = f; api++; Loading Loading @@ -429,18 +456,19 @@ egl_display_t* get_display(EGLDisplay dpy) return (index >= NUM_DISPLAYS) ? NULL : &gDisplay[index]; } template<typename NATIVE, typename EGL> static inline NATIVE* egl_to_native_cast(EGL arg) { return reinterpret_cast<NATIVE*>(arg); } static inline egl_surface_t* get_surface(EGLSurface surface) { egl_surface_t* s = (egl_surface_t *)surface; return s; egl_surface_t* get_surface(EGLSurface surface) { return egl_to_native_cast<egl_surface_t>(surface); } static inline egl_context_t* get_context(EGLContext context) { egl_context_t* c = (egl_context_t *)context; return c; egl_context_t* get_context(EGLContext context) { return egl_to_native_cast<egl_context_t>(context); } static egl_connection_t* validate_display_config( Loading @@ -451,7 +479,7 @@ static egl_connection_t* validate_display_config( if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL); impl = uintptr_t(config)>>24; if (uint32_t(impl) >= 2) { if (uint32_t(impl) >= IMPL_NUM_DRIVERS_IMPLEMENTATIONS) { return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); } index = uintptr_t(config) & 0xFFFFFF; Loading Loading @@ -491,13 +519,8 @@ static EGLBoolean validate_display_surface(EGLDisplay dpy, EGLSurface surface) return EGL_TRUE; } // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- using namespace android; EGLDisplay eglGetDisplay(NativeDisplayType display) EGLDisplay egl_init_displays(NativeDisplayType display) { if (sEarlyInitState) { return EGL_NO_DISPLAY; Loading Loading @@ -573,6 +596,18 @@ EGLDisplay eglGetDisplay(NativeDisplayType display) return dpy; } // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- using namespace android; EGLDisplay eglGetDisplay(NativeDisplayType display) { return egl_init_displays(display); } // ---------------------------------------------------------------------------- // Initialization // ---------------------------------------------------------------------------- Loading @@ -594,7 +629,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) // build our own extension string first, based on the extension we know // and the extension supported by our client implementation dp->extensionsString = strdup(gExtensionString); for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; cnx->major = -1; cnx->minor = -1; Loading Loading @@ -624,7 +659,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) } EGLBoolean res = EGL_FALSE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso && cnx->major>=0 && cnx->minor>=0) { EGLint n; Loading Loading @@ -663,7 +698,7 @@ EGLBoolean eglTerminate(EGLDisplay dpy) return EGL_TRUE; EGLBoolean res = EGL_FALSE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { cnx->hooks->egl.eglTerminate(dp->dpys[i]); Loading Loading @@ -706,7 +741,7 @@ EGLBoolean eglGetConfigs( EGLDisplay dpy, return EGL_TRUE; } GLint n = 0; for (int j=0 ; j<2 ; j++) { for (int j=0 ; j<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; j++) { for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) { *configs++ = MAKE_CONFIG(j, i); config_size--; Loading Loading @@ -794,7 +829,7 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, return res; } for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglChooseConfig( Loading Loading @@ -1107,7 +1142,7 @@ EGLBoolean eglWaitNative(EGLint engine) EGLint eglGetError(void) { EGLint result = EGL_SUCCESS; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { EGLint err = EGL_SUCCESS; egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) Loading @@ -1120,8 +1155,15 @@ EGLint eglGetError(void) return result; } void (*eglGetProcAddress(const char *procname))() __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) { // eglGetProcAddress() could be the very first function called // in which case we must make sure we've initialized ourselves, this // happens the first time egl_get_display() is called. if (egl_init_displays(EGL_DEFAULT_DISPLAY) == EGL_NO_DISPLAY) return NULL; __eglMustCastToProperFunctionPointerType addr; addr = findProcAddress(procname, gExtentionMap, NELEM(gExtentionMap)); if (addr) return addr; Loading @@ -1133,7 +1175,7 @@ void (*eglGetProcAddress(const char *procname))() addr = 0; int slot = -1; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglGetProcAddress) { Loading Loading @@ -1266,7 +1308,7 @@ EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); EGLBoolean res = EGL_TRUE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglSwapInterval) { Loading Loading @@ -1309,7 +1351,7 @@ EGLBoolean eglBindAPI(EGLenum api) { // bind this API on all EGLs EGLBoolean res = EGL_TRUE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglBindAPI) { Loading @@ -1324,7 +1366,7 @@ EGLBoolean eglBindAPI(EGLenum api) EGLenum eglQueryAPI(void) { for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglQueryAPI) { Loading @@ -1340,7 +1382,7 @@ EGLenum eglQueryAPI(void) EGLBoolean eglReleaseThread(void) { for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglReleaseThread) { Loading opengl/libs/GLES_CM/gl.cpp +17 −9 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <cutils/properties.h> #include "hooks.h" #include "egl_impl.h" using namespace android; Loading Loading @@ -57,13 +58,6 @@ void glVertexPointerBounds(GLint size, GLenum type, // Actual GL entry-points // ---------------------------------------------------------------------------- #if GL_LOGGER # include "gl_logger.h" # define GL_LOGGER_IMPL(_x) _x #else # define GL_LOGGER_IMPL(_x) #endif #undef API_ENTRY #undef CALL_GL_API #undef CALL_GL_API_RETURN Loading Loading @@ -96,16 +90,15 @@ void glVertexPointerBounds(GLint size, GLenum type, #define CALL_GL_API(_api, ...) \ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); ) \ _c->_api(__VA_ARGS__) #define CALL_GL_API_RETURN(_api, ...) \ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); ) \ return _c->_api(__VA_ARGS__) #endif extern "C" { #include "gl_api.in" } Loading @@ -114,3 +107,18 @@ extern "C" { #undef CALL_GL_API #undef CALL_GL_API_RETURN /* * These GL calls are special because they need to EGL to retrieve some * informations before they can execute. */ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) { } void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { } Loading
opengl/libagl/egl.cpp +43 −25 Original line number Diff line number Diff line Loading @@ -478,22 +478,38 @@ struct extention_map_t { }; static const extention_map_t gExtentionMap[] = { { "glDrawTexsOES", (void(*)())&glDrawTexsOES }, { "glDrawTexiOES", (void(*)())&glDrawTexiOES }, { "glDrawTexfOES", (void(*)())&glDrawTexfOES }, { "glDrawTexxOES", (void(*)())&glDrawTexxOES }, { "glDrawTexsvOES", (void(*)())&glDrawTexsvOES }, { "glDrawTexivOES", (void(*)())&glDrawTexivOES }, { "glDrawTexfvOES", (void(*)())&glDrawTexfvOES }, { "glDrawTexxvOES", (void(*)())&glDrawTexxvOES }, { "glQueryMatrixxOES", (void(*)())&glQueryMatrixxOES }, { "glClipPlanef", (void(*)())&glClipPlanef }, { "glClipPlanex", (void(*)())&glClipPlanex }, { "glBindBuffer", (void(*)())&glBindBuffer }, { "glBufferData", (void(*)())&glBufferData }, { "glBufferSubData", (void(*)())&glBufferSubData }, { "glDeleteBuffers", (void(*)())&glDeleteBuffers }, { "glGenBuffers", (void(*)())&glGenBuffers }, { "glDrawTexsOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES }, { "glDrawTexiOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES }, { "glDrawTexfOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES }, { "glDrawTexxOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES }, { "glDrawTexsvOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES }, { "glDrawTexivOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES }, { "glDrawTexfvOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES }, { "glDrawTexxvOES", (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES }, { "glQueryMatrixxOES", (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES }, { "glClipPlanef", (__eglMustCastToProperFunctionPointerType)&glClipPlanef }, { "glClipPlanex", (__eglMustCastToProperFunctionPointerType)&glClipPlanex }, { "glBindBuffer", (__eglMustCastToProperFunctionPointerType)&glBindBuffer }, { "glBufferData", (__eglMustCastToProperFunctionPointerType)&glBufferData }, { "glBufferSubData", (__eglMustCastToProperFunctionPointerType)&glBufferSubData }, { "glDeleteBuffers", (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers }, { "glGenBuffers", (__eglMustCastToProperFunctionPointerType)&glGenBuffers }, }; /* Loading Loading @@ -1299,6 +1315,8 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, } } // TODO: call connect / disconnect on the surface ogles_context_t* gl = (ogles_context_t*)ctx; if (makeCurrent(gl) == 0) { if (ctx) { Loading
opengl/libs/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ GLES_CM/gl.cpp.arm \ GLES_CM/gl_logger.cpp \ # LOCAL_SHARED_LIBRARIES += libcutils libutils libui libEGL Loading
opengl/libs/EGL/egl.cpp +90 −48 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ ** limitations under the License. */ #define LOG_TAG "GLLogger" #define LOG_TAG "libEGL" #include <ctype.h> #include <string.h> Loading Loading @@ -69,9 +69,9 @@ private: struct egl_display_t : public egl_object_t<'_dpy'> { EGLDisplay dpys[2]; EGLConfig* configs[2]; EGLint numConfigs[2]; EGLDisplay dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; EGLConfig* configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; EGLint numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; EGLint numTotalConfigs; char const* extensionsString; volatile int32_t refs; Loading @@ -81,7 +81,7 @@ struct egl_display_t : public egl_object_t<'_dpy'> char const * clientApi; char const * extensions; }; strings_t queryString[2]; strings_t queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; }; struct egl_surface_t : public egl_object_t<'_srf'> Loading Loading @@ -156,7 +156,7 @@ static char const * const egl_names[] = { // ---------------------------------------------------------------------------- egl_connection_t gEGLImpl[2]; egl_connection_t gEGLImpl[IMPL_NUM_DRIVERS_IMPLEMENTATIONS]; static egl_display_t gDisplay[NUM_DISPLAYS]; static pthread_mutex_t gThreadLocalStorageKeyMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_key_t gEGLThreadLocalStorageKey = -1; Loading Loading @@ -278,29 +278,56 @@ void *load_driver(const char* driver, gl_hooks_t* hooks) driver, dlerror()); if (dso) { void** curr; // first find the symbol for eglGetProcAddress typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)( const char*); getProcAddressType getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress"); LOGE_IF(!getProcAddress, "can't find eglGetProcAddress() in %s", driver); __eglMustCastToProperFunctionPointerType* curr; char const * const * api; gl_hooks_t::gl_t* gl = &hooks->gl; curr = (void**)gl; api = gl_names; gl_hooks_t::egl_t* egl = &hooks->egl; curr = (__eglMustCastToProperFunctionPointerType*)egl; api = egl_names; while (*api) { void* f = dlsym(dso, *api); //LOGD("<%s> @ 0x%p", *api, f); char const * name = *api; __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { //LOGW("<%s> not found in %s", *api, driver); f = (void*)gl_unimplemented; // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); if (f == NULL) { f = (__eglMustCastToProperFunctionPointerType)0; } } *curr++ = f; api++; } gl_hooks_t::egl_t* egl = &hooks->egl; curr = (void**)egl; api = egl_names; gl_hooks_t::gl_t* gl = &hooks->gl; curr = (__eglMustCastToProperFunctionPointerType*)gl; api = gl_names; while (*api) { void* f = dlsym(dso, *api); char const * name = *api; // if the function starts with '__' it's a special case that // uses a wrapper. skip the '__' when looking into the real lib. if (name[0] == '_' && name[1] == '_') { name += 2; } __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); if (f == NULL) { //LOGW("<%s> not found in %s", *api, driver); f = (void*)0; f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; } } *curr++ = f; api++; Loading Loading @@ -429,18 +456,19 @@ egl_display_t* get_display(EGLDisplay dpy) return (index >= NUM_DISPLAYS) ? NULL : &gDisplay[index]; } template<typename NATIVE, typename EGL> static inline NATIVE* egl_to_native_cast(EGL arg) { return reinterpret_cast<NATIVE*>(arg); } static inline egl_surface_t* get_surface(EGLSurface surface) { egl_surface_t* s = (egl_surface_t *)surface; return s; egl_surface_t* get_surface(EGLSurface surface) { return egl_to_native_cast<egl_surface_t>(surface); } static inline egl_context_t* get_context(EGLContext context) { egl_context_t* c = (egl_context_t *)context; return c; egl_context_t* get_context(EGLContext context) { return egl_to_native_cast<egl_context_t>(context); } static egl_connection_t* validate_display_config( Loading @@ -451,7 +479,7 @@ static egl_connection_t* validate_display_config( if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL); impl = uintptr_t(config)>>24; if (uint32_t(impl) >= 2) { if (uint32_t(impl) >= IMPL_NUM_DRIVERS_IMPLEMENTATIONS) { return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); } index = uintptr_t(config) & 0xFFFFFF; Loading Loading @@ -491,13 +519,8 @@ static EGLBoolean validate_display_surface(EGLDisplay dpy, EGLSurface surface) return EGL_TRUE; } // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- using namespace android; EGLDisplay eglGetDisplay(NativeDisplayType display) EGLDisplay egl_init_displays(NativeDisplayType display) { if (sEarlyInitState) { return EGL_NO_DISPLAY; Loading Loading @@ -573,6 +596,18 @@ EGLDisplay eglGetDisplay(NativeDisplayType display) return dpy; } // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- using namespace android; EGLDisplay eglGetDisplay(NativeDisplayType display) { return egl_init_displays(display); } // ---------------------------------------------------------------------------- // Initialization // ---------------------------------------------------------------------------- Loading @@ -594,7 +629,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) // build our own extension string first, based on the extension we know // and the extension supported by our client implementation dp->extensionsString = strdup(gExtensionString); for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; cnx->major = -1; cnx->minor = -1; Loading Loading @@ -624,7 +659,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) } EGLBoolean res = EGL_FALSE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso && cnx->major>=0 && cnx->minor>=0) { EGLint n; Loading Loading @@ -663,7 +698,7 @@ EGLBoolean eglTerminate(EGLDisplay dpy) return EGL_TRUE; EGLBoolean res = EGL_FALSE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { cnx->hooks->egl.eglTerminate(dp->dpys[i]); Loading Loading @@ -706,7 +741,7 @@ EGLBoolean eglGetConfigs( EGLDisplay dpy, return EGL_TRUE; } GLint n = 0; for (int j=0 ; j<2 ; j++) { for (int j=0 ; j<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; j++) { for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) { *configs++ = MAKE_CONFIG(j, i); config_size--; Loading Loading @@ -794,7 +829,7 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, return res; } for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglChooseConfig( Loading Loading @@ -1107,7 +1142,7 @@ EGLBoolean eglWaitNative(EGLint engine) EGLint eglGetError(void) { EGLint result = EGL_SUCCESS; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { EGLint err = EGL_SUCCESS; egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) Loading @@ -1120,8 +1155,15 @@ EGLint eglGetError(void) return result; } void (*eglGetProcAddress(const char *procname))() __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) { // eglGetProcAddress() could be the very first function called // in which case we must make sure we've initialized ourselves, this // happens the first time egl_get_display() is called. if (egl_init_displays(EGL_DEFAULT_DISPLAY) == EGL_NO_DISPLAY) return NULL; __eglMustCastToProperFunctionPointerType addr; addr = findProcAddress(procname, gExtentionMap, NELEM(gExtentionMap)); if (addr) return addr; Loading @@ -1133,7 +1175,7 @@ void (*eglGetProcAddress(const char *procname))() addr = 0; int slot = -1; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglGetProcAddress) { Loading Loading @@ -1266,7 +1308,7 @@ EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); EGLBoolean res = EGL_TRUE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglSwapInterval) { Loading Loading @@ -1309,7 +1351,7 @@ EGLBoolean eglBindAPI(EGLenum api) { // bind this API on all EGLs EGLBoolean res = EGL_TRUE; for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglBindAPI) { Loading @@ -1324,7 +1366,7 @@ EGLBoolean eglBindAPI(EGLenum api) EGLenum eglQueryAPI(void) { for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglQueryAPI) { Loading @@ -1340,7 +1382,7 @@ EGLenum eglQueryAPI(void) EGLBoolean eglReleaseThread(void) { for (int i=0 ; i<2 ; i++) { for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso) { if (cnx->hooks->egl.eglReleaseThread) { Loading
opengl/libs/GLES_CM/gl.cpp +17 −9 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <cutils/properties.h> #include "hooks.h" #include "egl_impl.h" using namespace android; Loading Loading @@ -57,13 +58,6 @@ void glVertexPointerBounds(GLint size, GLenum type, // Actual GL entry-points // ---------------------------------------------------------------------------- #if GL_LOGGER # include "gl_logger.h" # define GL_LOGGER_IMPL(_x) _x #else # define GL_LOGGER_IMPL(_x) #endif #undef API_ENTRY #undef CALL_GL_API #undef CALL_GL_API_RETURN Loading Loading @@ -96,16 +90,15 @@ void glVertexPointerBounds(GLint size, GLenum type, #define CALL_GL_API(_api, ...) \ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); ) \ _c->_api(__VA_ARGS__) #define CALL_GL_API_RETURN(_api, ...) \ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); ) \ return _c->_api(__VA_ARGS__) #endif extern "C" { #include "gl_api.in" } Loading @@ -114,3 +107,18 @@ extern "C" { #undef CALL_GL_API #undef CALL_GL_API_RETURN /* * These GL calls are special because they need to EGL to retrieve some * informations before they can execute. */ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) { } void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { }