diff options
Diffstat (limited to 'opengl/libs')
-rw-r--r-- | opengl/libs/Android.mk | 53 | ||||
-rw-r--r-- | opengl/libs/EGL/egl.cpp | 1363 | ||||
-rw-r--r-- | opengl/libs/EGL/gpu.cpp | 212 | ||||
-rw-r--r-- | opengl/libs/GLES_CM/gl.cpp | 116 | ||||
-rw-r--r-- | opengl/libs/GLES_CM/gl_api.in | 606 | ||||
-rw-r--r-- | opengl/libs/GLES_CM/gl_logger.cpp | 1060 | ||||
-rw-r--r-- | opengl/libs/egl_entries.in | 45 | ||||
-rw-r--r-- | opengl/libs/egl_impl.h | 43 | ||||
-rw-r--r-- | opengl/libs/gl_entries.in | 159 | ||||
-rw-r--r-- | opengl/libs/gl_enums.in | 261 | ||||
-rw-r--r-- | opengl/libs/gl_logger.h | 26 | ||||
-rw-r--r-- | opengl/libs/hooks.h | 134 | ||||
-rw-r--r-- | opengl/libs/tools/enumextract.sh | 32 |
13 files changed, 0 insertions, 4110 deletions
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk deleted file mode 100644 index 2ecc776..0000000 --- a/opengl/libs/Android.mk +++ /dev/null @@ -1,53 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -# -# Build META EGL library -# - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - EGL/egl.cpp \ - EGL/gpu.cpp \ -# - -LOCAL_SHARED_LIBRARIES += libcutils libutils libui -LOCAL_LDLIBS := -lpthread -ldl -LOCAL_MODULE:= libEGL - -# needed on sim build because of weird logging issues -ifeq ($(TARGET_SIMULATOR),true) -else - LOCAL_SHARED_LIBRARIES += libdl - # we need to access the Bionic private header <bionic_tls.h> - LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../bionic/libc/private -endif - -include $(BUILD_SHARED_LIBRARY) - - - -# -# Build the wrapper OpenGL ES library -# - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - GLES_CM/gl.cpp.arm \ - GLES_CM/gl_logger.cpp \ -# - -LOCAL_SHARED_LIBRARIES += libcutils libutils libui libEGL -LOCAL_LDLIBS := -lpthread -ldl -LOCAL_MODULE:= libGLESv1_CM - -# needed on sim build because of weird logging issues -ifeq ($(TARGET_SIMULATOR),true) -else - LOCAL_SHARED_LIBRARIES += libdl - # we need to access the Bionic private header <bionic_tls.h> - LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../bionic/libc/private -endif - -include $(BUILD_SHARED_LIBRARY) diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp deleted file mode 100644 index e35773e..0000000 --- a/opengl/libs/EGL/egl.cpp +++ /dev/null @@ -1,1363 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#define LOG_TAG "GLLogger" - -#include <ctype.h> -#include <string.h> -#include <errno.h> -#include <dlfcn.h> - -#include <sys/ioctl.h> - -#if HAVE_ANDROID_OS -#include <linux/android_pmem.h> -#endif - -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <GLES/gl.h> -#include <GLES/glext.h> - -#include <cutils/log.h> -#include <cutils/atomic.h> -#include <cutils/properties.h> -#include <cutils/memory.h> - -#include <utils/RefBase.h> - -#include "hooks.h" -#include "egl_impl.h" - - -#define MAKE_CONFIG(_impl, _index) ((EGLConfig)(((_impl)<<24) | (_index))) -#define setError(_e, _r) setErrorEtc(__FUNCTION__, __LINE__, _e, _r) - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -#define VERSION_MINOR 1 -#define VERSION_MAJOR 4 -static char const * const gVendorString = "Android"; -static char const * const gVersionString = "1.31 Android META-EGL"; -static char const * const gClientApiString = "OpenGL ES"; -static char const * const gExtensionString = ""; - -template <int MAGIC> -struct egl_object_t -{ - egl_object_t() : magic(MAGIC) { } - ~egl_object_t() { magic = 0; } - bool isValid() const { return magic == MAGIC; } -private: - uint32_t magic; -}; - -struct egl_display_t : public egl_object_t<'_dpy'> -{ - EGLDisplay dpys[2]; - EGLConfig* configs[2]; - EGLint numConfigs[2]; - EGLint numTotalConfigs; - char const* extensionsString; - volatile int32_t refs; - struct strings_t { - char const * vendor; - char const * version; - char const * clientApi; - char const * extensions; - }; - strings_t queryString[2]; -}; - -struct egl_surface_t : public egl_object_t<'_srf'> -{ - egl_surface_t(EGLDisplay dpy, EGLSurface surface, - NativeWindowType window, int impl, egl_connection_t const* cnx) - : dpy(dpy), surface(surface), window(window), impl(impl), cnx(cnx) - { - // NOTE: window must be incRef'ed and connected already - } - ~egl_surface_t() { - if (window) { - if (window->disconnect) - window->disconnect(window); - window->decRef(window); - } - } - EGLDisplay dpy; - EGLSurface surface; - NativeWindowType window; - int impl; - egl_connection_t const* cnx; -}; - -struct egl_context_t : public egl_object_t<'_ctx'> -{ - egl_context_t(EGLDisplay dpy, EGLContext context, - int impl, egl_connection_t const* cnx) - : dpy(dpy), context(context), read(0), draw(0), impl(impl), cnx(cnx) - { - } - EGLDisplay dpy; - EGLContext context; - EGLSurface read; - EGLSurface draw; - int impl; - egl_connection_t const* cnx; -}; - -struct tls_t -{ - tls_t() : error(EGL_SUCCESS), ctx(0) { } - EGLint error; - EGLContext ctx; -}; - -static void gl_unimplemented() { - LOGE("called unimplemented OpenGL ES API"); -} - -// ---------------------------------------------------------------------------- -// GL / EGL hooks -// ---------------------------------------------------------------------------- - -#undef GL_ENTRY -#undef EGL_ENTRY -#define GL_ENTRY(_r, _api, ...) #_api, -#define EGL_ENTRY(_r, _api, ...) #_api, - -static char const * const gl_names[] = { - #include "gl_entries.in" - NULL -}; - -static char const * const egl_names[] = { - #include "egl_entries.in" - NULL -}; - -#undef GL_ENTRY -#undef EGL_ENTRY - -// ---------------------------------------------------------------------------- - -egl_connection_t gEGLImpl[2]; -static egl_display_t gDisplay[NUM_DISPLAYS]; -static pthread_mutex_t gThreadLocalStorageKeyMutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_key_t gEGLThreadLocalStorageKey = -1; - -// ---------------------------------------------------------------------------- - -gl_hooks_t gHooks[IMPL_NUM_IMPLEMENTATIONS]; -pthread_key_t gGLWrapperKey = -1; - -// ---------------------------------------------------------------------------- - -static __attribute__((noinline)) -const char *egl_strerror(EGLint err) -{ - switch (err){ - case EGL_SUCCESS: return "EGL_SUCCESS"; - case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED"; - case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS"; - case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC"; - case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE"; - case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG"; - case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT"; - case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE"; - case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY"; - case EGL_BAD_MATCH: return "EGL_BAD_MATCH"; - case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP"; - case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW"; - case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER"; - case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE"; - case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST"; - default: return "UNKNOWN"; - } -} - -static __attribute__((noinline)) -void clearTLS() { - if (gEGLThreadLocalStorageKey != -1) { - tls_t* tls = (tls_t*)pthread_getspecific(gEGLThreadLocalStorageKey); - if (tls) { - delete tls; - pthread_setspecific(gEGLThreadLocalStorageKey, 0); - } - } -} - -static tls_t* getTLS() -{ - tls_t* tls = (tls_t*)pthread_getspecific(gEGLThreadLocalStorageKey); - if (tls == 0) { - tls = new tls_t; - pthread_setspecific(gEGLThreadLocalStorageKey, tls); - } - return tls; -} - -template<typename T> -static __attribute__((noinline)) -T setErrorEtc(const char* caller, int line, EGLint error, T returnValue) { - if (gEGLThreadLocalStorageKey == -1) { - pthread_mutex_lock(&gThreadLocalStorageKeyMutex); - if (gEGLThreadLocalStorageKey == -1) - pthread_key_create(&gEGLThreadLocalStorageKey, NULL); - pthread_mutex_unlock(&gThreadLocalStorageKeyMutex); - } - tls_t* tls = getTLS(); - if (tls->error != error) { - LOGE("%s:%d error %x (%s)", caller, line, error, egl_strerror(error)); - tls->error = error; - } - return returnValue; -} - -static __attribute__((noinline)) -GLint getError() { - if (gEGLThreadLocalStorageKey == -1) - return EGL_SUCCESS; - tls_t* tls = (tls_t*)pthread_getspecific(gEGLThreadLocalStorageKey); - if (!tls) return EGL_SUCCESS; - GLint error = tls->error; - tls->error = EGL_SUCCESS; - return error; -} - -static __attribute__((noinline)) -void setContext(EGLContext ctx) { - if (gEGLThreadLocalStorageKey == -1) { - pthread_mutex_lock(&gThreadLocalStorageKeyMutex); - if (gEGLThreadLocalStorageKey == -1) - pthread_key_create(&gEGLThreadLocalStorageKey, NULL); - pthread_mutex_unlock(&gThreadLocalStorageKeyMutex); - } - tls_t* tls = getTLS(); - tls->ctx = ctx; -} - -static __attribute__((noinline)) -EGLContext getContext() { - if (gEGLThreadLocalStorageKey == -1) - return EGL_NO_CONTEXT; - tls_t* tls = (tls_t*)pthread_getspecific(gEGLThreadLocalStorageKey); - if (!tls) return EGL_NO_CONTEXT; - return tls->ctx; -} - - -/*****************************************************************************/ - -class ISurfaceComposer; -const sp<ISurfaceComposer>& getSurfaceFlinger(); -request_gpu_t* gpu_acquire(void* user); -int gpu_release(void*, request_gpu_t* gpu); - -static __attribute__((noinline)) -void *load_driver(const char* driver, gl_hooks_t* hooks) -{ - void* dso = dlopen(driver, RTLD_NOW | RTLD_LOCAL); - LOGE_IF(!dso, - "couldn't load <%s> library (%s)", - driver, dlerror()); - - if (dso) { - void** curr; - char const * const * api; - gl_hooks_t::gl_t* gl = &hooks->gl; - curr = (void**)gl; - api = gl_names; - while (*api) { - void* f = dlsym(dso, *api); - //LOGD("<%s> @ 0x%p", *api, f); - if (f == NULL) { - //LOGW("<%s> not found in %s", *api, driver); - f = (void*)gl_unimplemented; - } - *curr++ = f; - api++; - } - gl_hooks_t::egl_t* egl = &hooks->egl; - curr = (void**)egl; - api = egl_names; - while (*api) { - void* f = dlsym(dso, *api); - if (f == NULL) { - //LOGW("<%s> not found in %s", *api, driver); - f = (void*)0; - } - *curr++ = f; - api++; - } - - // hook this driver up with surfaceflinger if needed - register_gpu_t register_gpu = - (register_gpu_t)dlsym(dso, "oem_register_gpu"); - - if (register_gpu != NULL) { - if (getSurfaceFlinger() != 0) { - register_gpu(dso, gpu_acquire, gpu_release); - } - } - } - return dso; -} - -template<typename T> -static __attribute__((noinline)) -int binarySearch( - T const sortedArray[], int first, int last, T key) -{ - while (first <= last) { - int mid = (first + last) / 2; - if (key > sortedArray[mid]) { - first = mid + 1; - } else if (key < sortedArray[mid]) { - last = mid - 1; - } else { - return mid; - } - } - return -1; -} - -static EGLint configToUniqueId(egl_display_t const* dp, int i, int index) -{ - // NOTE: this mapping works only if we have no more than two EGLimpl - return (i>0 ? dp->numConfigs[0] : 0) + index; -} - -static void uniqueIdToConfig(egl_display_t const* dp, EGLint configId, - int& i, int& index) -{ - // NOTE: this mapping works only if we have no more than two EGLimpl - size_t numConfigs = dp->numConfigs[0]; - i = configId / numConfigs; - index = configId % numConfigs; -} - -static int cmp_configs(const void* a, const void *b) -{ - EGLConfig c0 = *(EGLConfig const *)a; - EGLConfig c1 = *(EGLConfig const *)b; - return c0<c1 ? -1 : (c0>c1 ? 1 : 0); -} - -struct extention_map_t { - const char* name; - __eglMustCastToProperFunctionPointerType address; -}; - -static const extention_map_t gExtentionMap[] = { -}; - -static extention_map_t gGLExtentionMap[MAX_NUMBER_OF_GL_EXTENSIONS]; - -static void(*findProcAddress(const char* name, - const extention_map_t* map, size_t n))() -{ - for (uint32_t i=0 ; i<n ; i++) { - if (!strcmp(name, map[i].name)) { - return map[i].address; - } - } - return NULL; -} - -// ---------------------------------------------------------------------------- - -static int gl_context_lost() { - setGlThreadSpecific(&gHooks[IMPL_CONTEXT_LOST]); - return 0; -} -static int egl_context_lost() { - setGlThreadSpecific(&gHooks[IMPL_CONTEXT_LOST]); - return EGL_FALSE; -} -static EGLBoolean egl_context_lost_swap_buffers(void*, void*) { - usleep(100000); // don't use all the CPU - setGlThreadSpecific(&gHooks[IMPL_CONTEXT_LOST]); - return EGL_FALSE; -} -static GLint egl_context_lost_get_error() { - return EGL_CONTEXT_LOST; -} -static int ext_context_lost() { - return 0; -} - -static void gl_no_context() { - LOGE("call to OpenGL ES API with no current context"); -} -static void early_egl_init(void) -{ -#if !USE_FAST_TLS_KEY - pthread_key_create(&gGLWrapperKey, NULL); -#endif - uint32_t addr = (uint32_t)((void*)gl_no_context); - android_memset32( - (uint32_t*)(void*)&gHooks[IMPL_NO_CONTEXT], - addr, - sizeof(gHooks[IMPL_NO_CONTEXT])); - setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]); -} - -static pthread_once_t once_control = PTHREAD_ONCE_INIT; -static int sEarlyInitState = pthread_once(&once_control, &early_egl_init); - - -static inline -egl_display_t* get_display(EGLDisplay dpy) -{ - uintptr_t index = uintptr_t(dpy)-1U; - return (index >= NUM_DISPLAYS) ? NULL : &gDisplay[index]; -} - -static inline -egl_surface_t* get_surface(EGLSurface surface) -{ - egl_surface_t* s = (egl_surface_t *)surface; - return s; -} - -static inline -egl_context_t* get_context(EGLContext context) -{ - egl_context_t* c = (egl_context_t *)context; - return c; -} - -static egl_connection_t* validate_display_config( - EGLDisplay dpy, EGLConfig config, - egl_display_t const*& dp, int& impl, int& index) -{ - dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL); - - impl = uintptr_t(config)>>24; - if (uint32_t(impl) >= 2) { - return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); - } - index = uintptr_t(config) & 0xFFFFFF; - if (index >= dp->numConfigs[impl]) { - return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); - } - egl_connection_t* const cnx = &gEGLImpl[impl]; - if (cnx->dso == 0) { - return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL); - } - return cnx; -} - -static EGLBoolean validate_display_context(EGLDisplay dpy, EGLContext ctx) -{ - if ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS) - return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (!get_display(dpy)->isValid()) - return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (!ctx) // TODO: make sure context is a valid object - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - if (!get_context(ctx)->isValid()) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - return EGL_TRUE; -} - -static EGLBoolean validate_display_surface(EGLDisplay dpy, EGLSurface surface) -{ - if ((uintptr_t(dpy)-1U) >= NUM_DISPLAYS) - return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (!get_display(dpy)->isValid()) - return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (!surface) // TODO: make sure surface is a valid object - return setError(EGL_BAD_SURFACE, EGL_FALSE); - if (!get_surface(surface)->isValid()) - return setError(EGL_BAD_SURFACE, EGL_FALSE); - return EGL_TRUE; -} - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- - -using namespace android; - -EGLDisplay eglGetDisplay(NativeDisplayType display) -{ - if (sEarlyInitState) { - return EGL_NO_DISPLAY; - } - - uint32_t index = uint32_t(display); - if (index >= NUM_DISPLAYS) { - return EGL_NO_DISPLAY; - } - - EGLDisplay dpy = EGLDisplay(uintptr_t(display) + 1LU); - egl_display_t* d = &gDisplay[index]; - - // dynamically load all our EGL implementations for that display - // and call into the real eglGetGisplay() - egl_connection_t* cnx = &gEGLImpl[IMPL_SOFTWARE]; - if (cnx->dso == 0) { - cnx->hooks = &gHooks[IMPL_SOFTWARE]; - cnx->dso = load_driver("libagl.so", cnx->hooks); - } - if (cnx->dso && d->dpys[IMPL_SOFTWARE]==EGL_NO_DISPLAY) { - d->dpys[IMPL_SOFTWARE] = cnx->hooks->egl.eglGetDisplay(display); - LOGE_IF(d->dpys[IMPL_SOFTWARE]==EGL_NO_DISPLAY, - "No EGLDisplay for software EGL!"); - } - - cnx = &gEGLImpl[IMPL_HARDWARE]; - if (cnx->dso == 0 && cnx->unavailable == 0) { - char value[PROPERTY_VALUE_MAX]; - property_get("debug.egl.hw", value, "1"); - if (atoi(value) != 0) { - cnx->hooks = &gHooks[IMPL_HARDWARE]; - cnx->dso = load_driver("libhgl.so", cnx->hooks); - } else { - LOGD("3D hardware acceleration is disabled"); - } - } - if (cnx->dso && d->dpys[IMPL_HARDWARE]==EGL_NO_DISPLAY) { - android_memset32( - (uint32_t*)(void*)&gHooks[IMPL_CONTEXT_LOST].gl, - (uint32_t)((void*)gl_context_lost), - sizeof(gHooks[IMPL_CONTEXT_LOST].gl)); - android_memset32( - (uint32_t*)(void*)&gHooks[IMPL_CONTEXT_LOST].egl, - (uint32_t)((void*)egl_context_lost), - sizeof(gHooks[IMPL_CONTEXT_LOST].egl)); - android_memset32( - (uint32_t*)(void*)&gHooks[IMPL_CONTEXT_LOST].ext, - (uint32_t)((void*)ext_context_lost), - sizeof(gHooks[IMPL_CONTEXT_LOST].ext)); - - gHooks[IMPL_CONTEXT_LOST].egl.eglSwapBuffers = - egl_context_lost_swap_buffers; - - gHooks[IMPL_CONTEXT_LOST].egl.eglGetError = - egl_context_lost_get_error; - - gHooks[IMPL_CONTEXT_LOST].egl.eglTerminate = - gHooks[IMPL_HARDWARE].egl.eglTerminate; - - d->dpys[IMPL_HARDWARE] = cnx->hooks->egl.eglGetDisplay(display); - if (d->dpys[IMPL_HARDWARE] == EGL_NO_DISPLAY) { - LOGE("h/w accelerated eglGetDisplay() failed (%s)", - egl_strerror(cnx->hooks->egl.eglGetError())); - dlclose((void*)cnx->dso); - cnx->dso = 0; - // in case of failure, we want to make sure we don't try again - // as it's expensive. - cnx->unavailable = 1; - } - } - - return dpy; -} - -// ---------------------------------------------------------------------------- -// Initialization -// ---------------------------------------------------------------------------- - -EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) -{ - egl_display_t * const dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - - if (android_atomic_inc(&dp->refs) > 0) { - if (major != NULL) *major = VERSION_MAJOR; - if (minor != NULL) *minor = VERSION_MINOR; - return EGL_TRUE; - } - - setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]); - - // initialize each EGL and - // 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++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - cnx->major = -1; - cnx->minor = -1; - if (!cnx->dso) - continue; - - if (cnx->hooks->egl.eglInitialize( - dp->dpys[i], &cnx->major, &cnx->minor)) { - - //LOGD("initialized %d dpy=%p, ver=%d.%d, cnx=%p", - // i, dp->dpys[i], cnx->major, cnx->minor, cnx); - - // get the query-strings for this display for each implementation - dp->queryString[i].vendor = - cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_VENDOR); - dp->queryString[i].version = - cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_VERSION); - dp->queryString[i].extensions = strdup( - cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_EXTENSIONS)); - dp->queryString[i].clientApi = - cnx->hooks->egl.eglQueryString(dp->dpys[i], EGL_CLIENT_APIS); - - } else { - LOGD("%d: eglInitialize() failed (%s)", - i, egl_strerror(cnx->hooks->egl.eglGetError())); - } - } - - EGLBoolean res = EGL_FALSE; - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso && cnx->major>=0 && cnx->minor>=0) { - EGLint n; - if (cnx->hooks->egl.eglGetConfigs(dp->dpys[i], 0, 0, &n)) { - dp->configs[i] = (EGLConfig*)malloc(sizeof(EGLConfig)*n); - if (dp->configs[i]) { - if (cnx->hooks->egl.eglGetConfigs( - dp->dpys[i], dp->configs[i], n, &dp->numConfigs[i])) - { - // sort the configurations so we can do binary searches - qsort( dp->configs[i], - dp->numConfigs[i], - sizeof(EGLConfig), cmp_configs); - - dp->numTotalConfigs += n; - res = EGL_TRUE; - } - } - } - } - } - - if (res == EGL_TRUE) { - if (major != NULL) *major = 1; - if (minor != NULL) *minor = 2; - return EGL_TRUE; - } - return setError(EGL_NOT_INITIALIZED, EGL_FALSE); -} - -EGLBoolean eglTerminate(EGLDisplay dpy) -{ - egl_display_t* const dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - if (android_atomic_dec(&dp->refs) != 1) - return EGL_TRUE; - - EGLBoolean res = EGL_FALSE; - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - cnx->hooks->egl.eglTerminate(dp->dpys[i]); - - /* REVISIT: it's unclear what to do if eglTerminate() fails, - * on one end we shouldn't care, on the other end if it fails - * it might not be safe to call dlclose() (there could be some - * threads around). */ - - free(dp->configs[i]); - free((void*)dp->queryString[i].extensions); - dp->numConfigs[i] = 0; - dp->dpys[i] = EGL_NO_DISPLAY; - dlclose((void*)cnx->dso); - cnx->dso = 0; - res = EGL_TRUE; - } - } - free((void*)dp->extensionsString); - dp->extensionsString = 0; - dp->numTotalConfigs = 0; - clearTLS(); - return res; -} - -// ---------------------------------------------------------------------------- -// configuration -// ---------------------------------------------------------------------------- - -EGLBoolean eglGetConfigs( EGLDisplay dpy, - EGLConfig *configs, - EGLint config_size, EGLint *num_config) -{ - egl_display_t const * const dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - - GLint numConfigs = dp->numTotalConfigs; - if (!configs) { - *num_config = numConfigs; - return EGL_TRUE; - } - GLint n = 0; - for (int j=0 ; j<2 ; j++) { - for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) { - *configs++ = MAKE_CONFIG(j, i); - config_size--; - n++; - } - } - - *num_config = n; - return EGL_TRUE; -} - -EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list, - EGLConfig *configs, EGLint config_size, - EGLint *num_config) -{ - egl_display_t const * const dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - - if (configs == 0) { - *num_config = 0; - return EGL_TRUE; - } - - EGLint n; - EGLBoolean res = EGL_FALSE; - *num_config = 0; - - - // It is unfortunate, but we need to remap the EGL_CONFIG_IDs, - // to do this, we have to go through the attrib_list array once - // to figure out both its size and if it contains an EGL_CONFIG_ID - // key. If so, the full array is copied and patched. - // NOTE: we assume that there can be only one occurrence - // of EGL_CONFIG_ID. - - EGLint patch_index = -1; - GLint attr; - size_t size = 0; - while ((attr=attrib_list[size])) { - if (attr == EGL_CONFIG_ID) - patch_index = size; - size += 2; - } - if (patch_index >= 0) { - size += 2; // we need copy the sentinel as well - EGLint* new_list = (EGLint*)malloc(size*sizeof(EGLint)); - if (new_list == 0) - return setError(EGL_BAD_ALLOC, EGL_FALSE); - memcpy(new_list, attrib_list, size*sizeof(EGLint)); - - // patch the requested EGL_CONFIG_ID - int i, index; - EGLint& configId(new_list[patch_index+1]); - uniqueIdToConfig(dp, configId, i, index); - - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - cnx->hooks->egl.eglGetConfigAttrib( - dp->dpys[i], dp->configs[i][index], - EGL_CONFIG_ID, &configId); - - // and switch to the new list - attrib_list = const_cast<const EGLint *>(new_list); - - // At this point, the only configuration that can match is - // dp->configs[i][index], however, we don't know if it would be - // rejected because of the other attributes, so we do have to call - // cnx->hooks->egl.eglChooseConfig() -- but we don't have to loop - // through all the EGLimpl[]. - // We also know we can only get a single config back, and we know - // which one. - - res = cnx->hooks->egl.eglChooseConfig( - dp->dpys[i], attrib_list, configs, config_size, &n); - if (res && n>0) { - // n has to be 0 or 1, by construction, and we already know - // which config it will return (since there can be only one). - configs[0] = MAKE_CONFIG(i, index); - *num_config = 1; - } - } - - free(const_cast<EGLint *>(attrib_list)); - return res; - } - - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - if (cnx->hooks->egl.eglChooseConfig( - dp->dpys[i], attrib_list, configs, config_size, &n)) { - // now we need to convert these client EGLConfig to our - // internal EGLConfig format. This is done in O(n log n). - for (int j=0 ; j<n ; j++) { - int index = binarySearch<EGLConfig>( - dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]); - if (index >= 0) { - configs[j] = MAKE_CONFIG(i, index); - } else { - return setError(EGL_BAD_CONFIG, EGL_FALSE); - } - } - configs += n; - config_size -= n; - *num_config += n; - res = EGL_TRUE; - } - } - } - return res; -} - -EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint *value) -{ - egl_display_t const* dp = 0; - int i=0, index=0; - egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index); - if (!cnx) return EGL_FALSE; - - if (attribute == EGL_CONFIG_ID) { - // EGL_CONFIG_IDs must be unique, just use the order of the selected - // EGLConfig. - *value = configToUniqueId(dp, i, index); - return EGL_TRUE; - } - return cnx->hooks->egl.eglGetConfigAttrib( - dp->dpys[i], dp->configs[i][index], attribute, value); -} - -// ---------------------------------------------------------------------------- -// surfaces -// ---------------------------------------------------------------------------- - -EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, - NativeWindowType window, - const EGLint *attrib_list) -{ - egl_display_t const* dp = 0; - int i=0, index=0; - egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index); - if (cnx) { - // window must be connected upon calling underlying - // eglCreateWindowSurface - if (window) { - window->incRef(window); - if (window->connect) - window->connect(window); - } - - EGLSurface surface = cnx->hooks->egl.eglCreateWindowSurface( - dp->dpys[i], dp->configs[i][index], window, attrib_list); - if (surface != EGL_NO_SURFACE) { - egl_surface_t* s = new egl_surface_t(dpy, surface, window, i, cnx); - return s; - } - - // something went wrong, disconnect and free window - // (will disconnect() automatically) - if (window) { - window->decRef(window); - } - } - return EGL_NO_SURFACE; -} - -EGLSurface eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config, - NativePixmapType pixmap, - const EGLint *attrib_list) -{ - egl_display_t const* dp = 0; - int i=0, index=0; - egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index); - if (cnx) { - EGLSurface surface = cnx->hooks->egl.eglCreatePixmapSurface( - dp->dpys[i], dp->configs[i][index], pixmap, attrib_list); - if (surface != EGL_NO_SURFACE) { - egl_surface_t* s = new egl_surface_t(dpy, surface, NULL, i, cnx); - return s; - } - } - return EGL_NO_SURFACE; -} - -EGLSurface eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) -{ - egl_display_t const* dp = 0; - int i=0, index=0; - egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index); - if (cnx) { - EGLSurface surface = cnx->hooks->egl.eglCreatePbufferSurface( - dp->dpys[i], dp->configs[i][index], attrib_list); - if (surface != EGL_NO_SURFACE) { - egl_surface_t* s = new egl_surface_t(dpy, surface, NULL, i, cnx); - return s; - } - } - return EGL_NO_SURFACE; -} - -EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) -{ - if (!validate_display_surface(dpy, surface)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(surface); - - EGLBoolean result = s->cnx->hooks->egl.eglDestroySurface( - dp->dpys[s->impl], s->surface); - - delete s; - return result; -} - -EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint *value) -{ - if (!validate_display_surface(dpy, surface)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(surface); - - return s->cnx->hooks->egl.eglQuerySurface( - dp->dpys[s->impl], s->surface, attribute, value); -} - -// ---------------------------------------------------------------------------- -// contextes -// ---------------------------------------------------------------------------- - -EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, - EGLContext share_list, const EGLint *attrib_list) -{ - egl_display_t const* dp = 0; - int i=0, index=0; - egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index); - if (cnx) { - EGLContext context = cnx->hooks->egl.eglCreateContext( - dp->dpys[i], dp->configs[i][index], share_list, attrib_list); - if (context != EGL_NO_CONTEXT) { - egl_context_t* c = new egl_context_t(dpy, context, i, cnx); - return c; - } - } - return EGL_NO_CONTEXT; -} - -EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) -{ - if (!validate_display_context(dpy, ctx)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_context_t * const c = get_context(ctx); - EGLBoolean result = c->cnx->hooks->egl.eglDestroyContext( - dp->dpys[c->impl], c->context); - delete c; - return result; -} - -EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext ctx) -{ - egl_display_t const * const dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - - if (read == EGL_NO_SURFACE && draw == EGL_NO_SURFACE && - ctx == EGL_NO_CONTEXT) - { - EGLBoolean result = EGL_TRUE; - ctx = getContext(); - if (ctx) { - egl_context_t * const c = get_context(ctx); - result = c->cnx->hooks->egl.eglMakeCurrent(dp->dpys[c->impl], 0, 0, 0); - if (result == EGL_TRUE) { - setGlThreadSpecific(&gHooks[IMPL_NO_CONTEXT]); - setContext(EGL_NO_CONTEXT); - } - } - return result; - } - - if (!validate_display_context(dpy, ctx)) - return EGL_FALSE; - - egl_context_t * const c = get_context(ctx); - if (draw != EGL_NO_SURFACE) { - egl_surface_t const * d = get_surface(draw); - if (!d) return setError(EGL_BAD_SURFACE, EGL_FALSE); - if (d->impl != c->impl) - return setError(EGL_BAD_MATCH, EGL_FALSE); - draw = d->surface; - } - if (read != EGL_NO_SURFACE) { - egl_surface_t const * r = get_surface(read); - if (!r) return setError(EGL_BAD_SURFACE, EGL_FALSE); - if (r->impl != c->impl) - return setError(EGL_BAD_MATCH, EGL_FALSE); - read = r->surface; - } - EGLBoolean result = c->cnx->hooks->egl.eglMakeCurrent( - dp->dpys[c->impl], draw, read, c->context); - - if (result == EGL_TRUE) { - setGlThreadSpecific(c->cnx->hooks); - setContext(ctx); - c->read = read; - c->draw = draw; - } - return result; -} - - -EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx, - EGLint attribute, EGLint *value) -{ - if (!validate_display_context(dpy, ctx)) - return EGL_FALSE; - - egl_display_t const * const dp = get_display(dpy); - egl_context_t * const c = get_context(ctx); - - return c->cnx->hooks->egl.eglQueryContext( - dp->dpys[c->impl], c->context, attribute, value); -} - -EGLContext eglGetCurrentContext(void) -{ - EGLContext ctx = getContext(); - return ctx; -} - -EGLSurface eglGetCurrentSurface(EGLint readdraw) -{ - EGLContext ctx = getContext(); - if (ctx) { - egl_context_t const * const c = get_context(ctx); - if (!c) return setError(EGL_BAD_CONTEXT, EGL_NO_SURFACE); - switch (readdraw) { - case EGL_READ: return c->read; - case EGL_DRAW: return c->draw; - default: return setError(EGL_BAD_PARAMETER, EGL_NO_SURFACE); - } - } - return EGL_NO_SURFACE; -} - -EGLDisplay eglGetCurrentDisplay(void) -{ - EGLContext ctx = getContext(); - if (ctx) { - egl_context_t const * const c = get_context(ctx); - if (!c) return setError(EGL_BAD_CONTEXT, EGL_NO_SURFACE); - return c->dpy; - } - return EGL_NO_DISPLAY; -} - -EGLBoolean eglWaitGL(void) -{ - EGLBoolean res = EGL_TRUE; - EGLContext ctx = getContext(); - if (ctx) { - egl_context_t const * const c = get_context(ctx); - if (!c) return setError(EGL_BAD_CONTEXT, EGL_FALSE); - if (uint32_t(c->impl)>=2) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - egl_connection_t* const cnx = &gEGLImpl[c->impl]; - if (!cnx->dso) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - res = cnx->hooks->egl.eglWaitGL(); - } - return res; -} - -EGLBoolean eglWaitNative(EGLint engine) -{ - EGLBoolean res = EGL_TRUE; - EGLContext ctx = getContext(); - if (ctx) { - egl_context_t const * const c = get_context(ctx); - if (!c) return setError(EGL_BAD_CONTEXT, EGL_FALSE); - if (uint32_t(c->impl)>=2) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - egl_connection_t* const cnx = &gEGLImpl[c->impl]; - if (!cnx->dso) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - res = cnx->hooks->egl.eglWaitNative(engine); - } - return res; -} - -EGLint eglGetError(void) -{ - EGLint result = EGL_SUCCESS; - for (int i=0 ; i<2 ; i++) { - EGLint err = EGL_SUCCESS; - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) - err = cnx->hooks->egl.eglGetError(); - if (err!=EGL_SUCCESS && result==EGL_SUCCESS) - result = err; - } - if (result == EGL_SUCCESS) - result = getError(); - return result; -} - -void (*eglGetProcAddress(const char *procname))() -{ - __eglMustCastToProperFunctionPointerType addr; - addr = findProcAddress(procname, gExtentionMap, NELEM(gExtentionMap)); - if (addr) return addr; - - return NULL; // TODO: finish implementation below - - addr = findProcAddress(procname, gGLExtentionMap, NELEM(gGLExtentionMap)); - if (addr) return addr; - - addr = 0; - int slot = -1; - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - if (cnx->hooks->egl.eglGetProcAddress) { - addr = cnx->hooks->egl.eglGetProcAddress(procname); - if (addr) { - if (slot == -1) { - slot = 0; // XXX: find free slot - if (slot == -1) { - addr = 0; - break; - } - } - cnx->hooks->ext.extensions[slot] = addr; - } - } - } - } - - if (slot >= 0) { - addr = 0; // XXX: address of stub 'slot' - gGLExtentionMap[slot].name = strdup(procname); - gGLExtentionMap[slot].address = addr; - } - - return addr; - - - /* - * TODO: For OpenGL ES extensions, we must generate a stub - * that looks like - * mov r12, #0xFFFF0FFF - * ldr r12, [r12, #-15] - * ldr r12, [r12, #TLS_SLOT_OPENGL_API*4] - * mov r12, [r12, #api_offset] - * ldrne pc, r12 - * mov pc, #unsupported_extension - * - * and write the address of the extension in *all* - * gl_hooks_t::gl_ext_t at offset "api_offset" from gl_hooks_t - * - */ -} - -EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) -{ - if (!validate_display_surface(dpy, draw)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(draw); - return s->cnx->hooks->egl.eglSwapBuffers(dp->dpys[s->impl], s->surface); -} - -EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface, - NativePixmapType target) -{ - if (!validate_display_surface(dpy, surface)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(surface); - return s->cnx->hooks->egl.eglCopyBuffers( - dp->dpys[s->impl], s->surface, target); -} - -const char* eglQueryString(EGLDisplay dpy, EGLint name) -{ - egl_display_t const * const dp = get_display(dpy); - switch (name) { - case EGL_VENDOR: - return gVendorString; - case EGL_VERSION: - return gVersionString; - case EGL_EXTENSIONS: - return gExtensionString; - case EGL_CLIENT_APIS: - return gClientApiString; - } - return setError(EGL_BAD_PARAMETER, (const char *)0); -} - - -// ---------------------------------------------------------------------------- -// EGL 1.1 -// ---------------------------------------------------------------------------- - -EGLBoolean eglSurfaceAttrib( - EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) -{ - if (!validate_display_surface(dpy, surface)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(surface); - if (s->cnx->hooks->egl.eglSurfaceAttrib) { - return s->cnx->hooks->egl.eglSurfaceAttrib( - dp->dpys[s->impl], s->surface, attribute, value); - } - return setError(EGL_BAD_SURFACE, EGL_FALSE); -} - -EGLBoolean eglBindTexImage( - EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - if (!validate_display_surface(dpy, surface)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(surface); - if (s->cnx->hooks->egl.eglBindTexImage) { - return s->cnx->hooks->egl.eglBindTexImage( - dp->dpys[s->impl], s->surface, buffer); - } - return setError(EGL_BAD_SURFACE, EGL_FALSE); -} - -EGLBoolean eglReleaseTexImage( - EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - if (!validate_display_surface(dpy, surface)) - return EGL_FALSE; - egl_display_t const * const dp = get_display(dpy); - egl_surface_t const * const s = get_surface(surface); - if (s->cnx->hooks->egl.eglReleaseTexImage) { - return s->cnx->hooks->egl.eglReleaseTexImage( - dp->dpys[s->impl], s->surface, buffer); - } - return setError(EGL_BAD_SURFACE, EGL_FALSE); -} - -EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) -{ - egl_display_t * const dp = get_display(dpy); - if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); - - EGLBoolean res = EGL_TRUE; - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - if (cnx->hooks->egl.eglSwapInterval) { - if (cnx->hooks->egl.eglSwapInterval(dp->dpys[i], interval) == EGL_FALSE) { - res = EGL_FALSE; - } - } - } - } - return res; -} - - -// ---------------------------------------------------------------------------- -// EGL 1.2 -// ---------------------------------------------------------------------------- - -EGLBoolean eglWaitClient(void) -{ - EGLBoolean res = EGL_TRUE; - EGLContext ctx = getContext(); - if (ctx) { - egl_context_t const * const c = get_context(ctx); - if (!c) return setError(EGL_BAD_CONTEXT, EGL_FALSE); - if (uint32_t(c->impl)>=2) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - egl_connection_t* const cnx = &gEGLImpl[c->impl]; - if (!cnx->dso) - return setError(EGL_BAD_CONTEXT, EGL_FALSE); - if (cnx->hooks->egl.eglWaitClient) { - res = cnx->hooks->egl.eglWaitClient(); - } else { - res = cnx->hooks->egl.eglWaitGL(); - } - } - return res; -} - -EGLBoolean eglBindAPI(EGLenum api) -{ - // bind this API on all EGLs - EGLBoolean res = EGL_TRUE; - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - if (cnx->hooks->egl.eglBindAPI) { - if (cnx->hooks->egl.eglBindAPI(api) == EGL_FALSE) { - res = EGL_FALSE; - } - } - } - } - return res; -} - -EGLenum eglQueryAPI(void) -{ - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - if (cnx->hooks->egl.eglQueryAPI) { - // the first one we find is okay, because they all - // should be the same - return cnx->hooks->egl.eglQueryAPI(); - } - } - } - // or, it can only be OpenGL ES - return EGL_OPENGL_ES_API; -} - -EGLBoolean eglReleaseThread(void) -{ - for (int i=0 ; i<2 ; i++) { - egl_connection_t* const cnx = &gEGLImpl[i]; - if (cnx->dso) { - if (cnx->hooks->egl.eglReleaseThread) { - cnx->hooks->egl.eglReleaseThread(); - } - } - } - clearTLS(); - return EGL_TRUE; -} - -EGLSurface eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list) -{ - egl_display_t const* dp = 0; - int i=0, index=0; - egl_connection_t* cnx = validate_display_config(dpy, config, dp, i, index); - if (!cnx) return EGL_FALSE; - if (cnx->hooks->egl.eglCreatePbufferFromClientBuffer) { - return cnx->hooks->egl.eglCreatePbufferFromClientBuffer( - dp->dpys[i], buftype, buffer, dp->configs[i][index], attrib_list); - } - return setError(EGL_BAD_CONFIG, EGL_NO_SURFACE); -} diff --git a/opengl/libs/EGL/gpu.cpp b/opengl/libs/EGL/gpu.cpp deleted file mode 100644 index 3f9fd63..0000000 --- a/opengl/libs/EGL/gpu.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#define LOG_TAG "EGL" - -#include <ctype.h> -#include <string.h> -#include <errno.h> - -#include <sys/ioctl.h> - -#if HAVE_ANDROID_OS -#include <linux/android_pmem.h> -#endif - -#include <cutils/log.h> -#include <cutils/properties.h> - -#include <utils/IMemory.h> -#include <utils/threads.h> -#include <utils/IServiceManager.h> -#include <utils/IPCThreadState.h> -#include <utils/Parcel.h> - -#include <ui/EGLDisplaySurface.h> -#include <ui/ISurfaceComposer.h> - -#include "hooks.h" -#include "egl_impl.h" - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -/* - * we provide our own allocators for the GPU regions, these - * allocators go through surfaceflinger - */ - -static Mutex gRegionsLock; -static request_gpu_t gRegions; -static sp<ISurfaceComposer> gSurfaceManager; -ISurfaceComposer* GLES_localSurfaceManager = 0; - -extern egl_connection_t gEGLImpl[2]; - -const sp<ISurfaceComposer>& getSurfaceFlinger() -{ - Mutex::Autolock _l(gRegionsLock); - - /* - * There is a little bit of voodoo magic here. We want to access - * surfaceflinger for allocating GPU regions, however, when we are - * running as part of surfaceflinger, we want to bypass the - * service manager because surfaceflinger might not be registered yet. - * SurfaceFlinger will populate "GLES_localSurfaceManager" with its - * own address, so we can just use that. - */ - if (gSurfaceManager == 0) { - if (GLES_localSurfaceManager) { - // we're running in SurfaceFlinger's context - gSurfaceManager = GLES_localSurfaceManager; - } else { - // we're a remote process or not part of surfaceflinger, - // go through the service manager - sp<IServiceManager> sm = defaultServiceManager(); - if (sm != NULL) { - sp<IBinder> binder = sm->getService(String16("SurfaceFlinger")); - gSurfaceManager = interface_cast<ISurfaceComposer>(binder); - } - } - } - return gSurfaceManager; -} - -class GPURevokeRequester : public BnGPUCallback -{ -public: - virtual void gpuLost() { - LOGD("CONTEXT_LOST: Releasing GPU upon request from SurfaceFlinger."); - gEGLImpl[IMPL_HARDWARE].hooks = &gHooks[IMPL_CONTEXT_LOST]; - } -}; - -static sp<GPURevokeRequester> gRevokerCallback; - - -request_gpu_t* gpu_acquire(void* user) -{ - sp<ISurfaceComposer> server( getSurfaceFlinger() ); - - Mutex::Autolock _l(gRegionsLock); - if (server == NULL) { - return 0; - } - - ISurfaceComposer::gpu_info_t info; - - if (gRevokerCallback == 0) - gRevokerCallback = new GPURevokeRequester(); - - status_t err = server->requestGPU(gRevokerCallback, &info); - if (err != NO_ERROR) { - LOGD("requestGPU returned %d", err); - return 0; - } - - bool failed = false; - request_gpu_t* gpu = &gRegions; - memset(gpu, 0, sizeof(*gpu)); - - if (info.regs != 0) { - sp<IMemoryHeap> heap(info.regs->getMemory()); - if (heap != 0) { - int fd = heap->heapID(); - gpu->regs.fd = fd; - gpu->regs.base = info.regs->pointer(); - gpu->regs.size = info.regs->size(); - gpu->regs.user = info.regs.get(); -#if HAVE_ANDROID_OS - struct pmem_region region; - if (ioctl(fd, PMEM_GET_PHYS, ®ion) >= 0) - gpu->regs.phys = (void*)region.offset; -#endif - info.regs->incStrong(gpu); - } else { - LOGE("GPU register handle %p is invalid!", info.regs.get()); - failed = true; - } - } - - for (size_t i=0 ; i<info.count && !failed ; i++) { - sp<IMemory>& region(info.regions[i].region); - if (region != 0) { - sp<IMemoryHeap> heap(region->getMemory()); - if (heap != 0) { - const int fd = heap->heapID(); - gpu->gpu[i].fd = fd; - gpu->gpu[i].base = region->pointer(); - gpu->gpu[i].size = region->size(); - gpu->gpu[i].user = region.get(); - gpu->gpu[i].offset = info.regions[i].reserved; -#if HAVE_ANDROID_OS - struct pmem_region reg; - if (ioctl(fd, PMEM_GET_PHYS, ®) >= 0) - gpu->gpu[i].phys = (void*)reg.offset; -#endif - region->incStrong(gpu); - } else { - LOGE("GPU region handle [%d, %p] is invalid!", i, region.get()); - failed = true; - } - } - } - - if (failed) { - // something went wrong, clean up everything! - if (gpu->regs.user) { - static_cast<IMemory*>(gpu->regs.user)->decStrong(gpu); - for (size_t i=0 ; i<info.count ; i++) { - if (gpu->gpu[i].user) { - static_cast<IMemory*>(gpu->gpu[i].user)->decStrong(gpu); - } - } - } - } - - gpu->count = info.count; - return gpu; -} - -int gpu_release(void*, request_gpu_t* gpu) -{ - sp<IMemory> regs; - - { // scope for lock - Mutex::Autolock _l(gRegionsLock); - regs = static_cast<IMemory*>(gpu->regs.user); - gpu->regs.user = 0; - if (regs != 0) regs->decStrong(gpu); - - for (int i=0 ; i<gpu->count ; i++) { - sp<IMemory> r(static_cast<IMemory*>(gpu->gpu[i].user)); - gpu->gpu[i].user = 0; - if (r != 0) r->decStrong(gpu); - } - } - - // there is a special transaction to relinquish the GPU - // (it will happen automatically anyway if we don't do this) - Parcel data, reply; - // NOTE: this transaction does not require an interface token - regs->asBinder()->transact(1000, data, &reply); - return 1; -} - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp deleted file mode 100644 index 865cf44..0000000 --- a/opengl/libs/GLES_CM/gl.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#define LOG_TAG "GLES_CM" - -#include <ctype.h> -#include <string.h> -#include <errno.h> - -#include <sys/ioctl.h> - -#include <GLES/gl.h> -#include <GLES/glext.h> - -#include <cutils/log.h> -#include <cutils/properties.h> - -#include "hooks.h" - -using namespace android; - -// ---------------------------------------------------------------------------- -// extensions for the framework -// ---------------------------------------------------------------------------- - -void glColorPointerBounds(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei count) { - glColorPointer(size, type, stride, ptr); -} -void glNormalPointerBounds(GLenum type, GLsizei stride, - const GLvoid *pointer, GLsizei count) { - glNormalPointer(type, stride, pointer); -} -void glTexCoordPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count) { - glTexCoordPointer(size, type, stride, pointer); -} -void glVertexPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count) { - glVertexPointer(size, type, stride, pointer); -} - -// ---------------------------------------------------------------------------- -// 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 - -#if USE_FAST_TLS_KEY - - #define API_ENTRY(_api) __attribute__((naked)) _api - - #define CALL_GL_API(_api, ...) \ - asm volatile( \ - "mov r12, #0xFFFF0FFF \n" \ - "ldr r12, [r12, #-15] \n" \ - "ldr r12, [r12, %[tls]] \n" \ - "cmp r12, #0 \n" \ - "ldrne pc, [r12, %[api]] \n" \ - "bx lr \n" \ - : \ - : [tls] "J"(TLS_SLOT_OPENGL_API*4), \ - [api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : \ - ); - - #define CALL_GL_API_RETURN(_api, ...) \ - CALL_GL_API(_api, __VA_ARGS__) \ - return 0; // placate gcc's warnings. never reached. - -#else - - #define API_ENTRY(_api) _api - - #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" -} - -#undef API_ENTRY -#undef CALL_GL_API -#undef CALL_GL_API_RETURN - diff --git a/opengl/libs/GLES_CM/gl_api.in b/opengl/libs/GLES_CM/gl_api.in deleted file mode 100644 index 9234ef2..0000000 --- a/opengl/libs/GLES_CM/gl_api.in +++ /dev/null @@ -1,606 +0,0 @@ -void API_ENTRY(glActiveTexture)(GLenum texture) { - CALL_GL_API(glActiveTexture, texture); -} - -void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) { - CALL_GL_API(glAlphaFunc, func, ref); -} - -void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) { - CALL_GL_API(glAlphaFuncx, func, ref); -} - -void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) { - CALL_GL_API(glBindTexture, target, texture); -} - -void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) { - CALL_GL_API(glBlendFunc, sfactor, dfactor); -} - -void API_ENTRY(glClear)(GLbitfield mask) { - CALL_GL_API(glClear, mask); -} - -void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - CALL_GL_API(glClearColor, red, green, blue, alpha); -} - -void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { - CALL_GL_API(glClearColorx, red, green, blue, alpha); -} - -void API_ENTRY(glClearDepthf)(GLclampf depth) { - CALL_GL_API(glClearDepthf, depth); -} - -void API_ENTRY(glClearDepthx)(GLclampx depth) { - CALL_GL_API(glClearDepthx, depth); -} - -void API_ENTRY(glClearStencil)(GLint s) { - CALL_GL_API(glClearStencil, s); -} - -void API_ENTRY(glClientActiveTexture)(GLenum texture) { - CALL_GL_API(glClientActiveTexture, texture); -} - -void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - CALL_GL_API(glColor4f, red, green, blue, alpha); -} - -void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { - CALL_GL_API(glColor4x, red, green, blue, alpha); -} - -void API_ENTRY(glColorMask)(GLboolean r, GLboolean g, GLboolean b, GLboolean a) { - CALL_GL_API(glColorMask, r, g, b, a); -} - -void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) -{ - CALL_GL_API(glColorPointer, size, type, stride, ptr); -} - -void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid *data) { - CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, - width, height, border, imageSize, data); -} - -void API_ENTRY(glCompressedTexSubImage2D)( GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLsizei imageSize, - const GLvoid *data) { - CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, - width, height, format, imageSize, data); -} - -void API_ENTRY(glCopyTexImage2D)( GLenum target, GLint level, GLenum internalformat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border) { - CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y, - width, height, border); -} - -void API_ENTRY(glCopyTexSubImage2D)( GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLint x, GLint y, GLsizei width, - GLsizei height) { - CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y, - width, height); -} - -void API_ENTRY(glCullFace)(GLenum mode) { - CALL_GL_API(glCullFace, mode); -} - -void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) { - CALL_GL_API(glDeleteTextures, n, textures); -} - -void API_ENTRY(glDepthFunc)(GLenum func) { - CALL_GL_API(glDepthFunc, func); -} - -void API_ENTRY(glDepthMask)(GLboolean flag) { - CALL_GL_API(glDepthMask, flag); -} - -void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) { - CALL_GL_API(glDepthRangef, zNear, zFar); -} - -void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) { - CALL_GL_API(glDepthRangex, zNear, zFar); -} - -void API_ENTRY(glDisable)(GLenum cap) { - CALL_GL_API(glDisable, cap); -} - -void API_ENTRY(glDisableClientState)(GLenum array) { - CALL_GL_API(glDisableClientState, array); -} - -void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) { - CALL_GL_API(glDrawArrays, mode, first, count); -} - -void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices) { - CALL_GL_API(glDrawElements, mode, count, type, indices); -} - -void API_ENTRY(glEnable)(GLenum cap) { - CALL_GL_API(glEnable, cap); -} - -void API_ENTRY(glEnableClientState)(GLenum array) { - CALL_GL_API(glEnableClientState, array); -} - -void API_ENTRY(glFinish)(void) { - CALL_GL_API(glFinish); -} - -void API_ENTRY(glFlush)(void) { - CALL_GL_API(glFlush); -} - -void API_ENTRY(glFogf)(GLenum pname, GLfloat param) { - CALL_GL_API(glFogf, pname, param); -} - -void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) { - CALL_GL_API(glFogfv, pname, params); -} - -void API_ENTRY(glFogx)(GLenum pname, GLfixed param) { - CALL_GL_API(glFogx, pname, param); -} - -void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) { - CALL_GL_API(glFogxv, pname, params); -} - -void API_ENTRY(glFrontFace)(GLenum mode) { - CALL_GL_API(glFrontFace, mode); -} - -void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat zNear, GLfloat zFar) { - CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar); -} - -void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right, - GLfixed bottom, GLfixed top, - GLfixed zNear, GLfixed zFar) { - CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar); -} - -void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) { - CALL_GL_API(glGenTextures, n, textures); -} - -GLenum API_ENTRY(glGetError)(void) { - CALL_GL_API_RETURN(glGetError); -} - -void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) { - CALL_GL_API(glGetIntegerv, pname, params); -} - -const GLubyte * API_ENTRY(glGetString)(GLenum name) { - CALL_GL_API_RETURN(glGetString, name); -} - -void API_ENTRY(glHint)(GLenum target, GLenum mode) { - CALL_GL_API(glHint, target, mode); -} - -void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) { - CALL_GL_API(glLightModelf, pname, param); -} - -void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) { - CALL_GL_API(glLightModelfv, pname, params); -} - -void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) { - CALL_GL_API(glLightModelx, pname, param); -} - -void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) { - CALL_GL_API(glLightModelxv, pname, params); -} - -void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) { - CALL_GL_API(glLightf, light, pname, param); -} - -void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) { - CALL_GL_API(glLightfv, light, pname, params); -} - -void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) { - CALL_GL_API(glLightx, light, pname, param); -} - -void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) { - CALL_GL_API(glLightxv, light, pname, params); -} - -void API_ENTRY(glLineWidth)(GLfloat width) { - CALL_GL_API(glLineWidth, width); -} - -void API_ENTRY(glLineWidthx)(GLfixed width) { - CALL_GL_API(glLineWidthx, width); -} - -void API_ENTRY(glLoadIdentity)(void) { - CALL_GL_API(glLoadIdentity); -} - -void API_ENTRY(glLoadMatrixf)(const GLfloat *m) { - CALL_GL_API(glLoadMatrixf, m); -} - -void API_ENTRY(glLoadMatrixx)(const GLfixed *m) { - CALL_GL_API(glLoadMatrixx, m); -} - -void API_ENTRY(glLogicOp)(GLenum opcode) { - CALL_GL_API(glLogicOp, opcode); -} - -void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) { - CALL_GL_API(glMaterialf, face, pname, param); -} - -void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) { - CALL_GL_API(glMaterialfv, face, pname, params); -} - -void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) { - CALL_GL_API(glMaterialx, face, pname, param); -} - -void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) { - CALL_GL_API(glMaterialxv, face, pname, params); -} - -void API_ENTRY(glMatrixMode)(GLenum mode) { - CALL_GL_API(glMatrixMode, mode); -} - -void API_ENTRY(glMultMatrixf)(const GLfloat *m) { - CALL_GL_API(glMultMatrixf, m); -} - -void API_ENTRY(glMultMatrixx)(const GLfixed *m) { - CALL_GL_API(glMultMatrixx, m); -} - -void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q); -} - -void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { - CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q); -} - -void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) { - CALL_GL_API(glNormal3f, nx, ny, nz); -} - -void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) { - CALL_GL_API(glNormal3x, nx, ny, nz); -} - -void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glNormalPointer, type, stride, pointer); -} - -void API_ENTRY(glOrthof)( GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat zNear, GLfloat zFar) { - CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar); -} - -void API_ENTRY(glOrthox)( GLfixed left, GLfixed right, - GLfixed bottom, GLfixed top, - GLfixed zNear, GLfixed zFar) { - CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar); -} - -void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) { - CALL_GL_API(glPixelStorei, pname, param); -} - -void API_ENTRY(glPointSize)(GLfloat size) { - CALL_GL_API(glPointSize, size); -} - -void API_ENTRY(glPointSizex)(GLfixed size) { - CALL_GL_API(glPointSizex, size); -} - -void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) { - CALL_GL_API(glPolygonOffset, factor, units); -} - -void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) { - CALL_GL_API(glPolygonOffsetx, factor, units); -} - -void API_ENTRY(glPopMatrix)(void) { - CALL_GL_API(glPopMatrix); -} - -void API_ENTRY(glPushMatrix)(void) { - CALL_GL_API(glPushMatrix); -} - -void API_ENTRY(glReadPixels)( GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid *pixels) { - CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels); -} - -void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glRotatef, angle, x, y, z); -} - -void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { - CALL_GL_API(glRotatex, angle, x, y, z); -} - -void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) { - CALL_GL_API(glSampleCoverage, value, invert); -} - -void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) { - CALL_GL_API(glSampleCoveragex, value, invert); -} - -void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glScalef, x, y, z); -} - -void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) { - CALL_GL_API(glScalex, x, y, z); -} - -void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) { - CALL_GL_API(glScissor, x, y, width, height); -} - -void API_ENTRY(glShadeModel)(GLenum mode) { - CALL_GL_API(glShadeModel, mode); -} - -void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) { - CALL_GL_API(glStencilFunc, func, ref, mask); -} - -void API_ENTRY(glStencilMask)(GLuint mask) { - CALL_GL_API(glStencilMask, mask); -} - -void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { - CALL_GL_API(glStencilOp, fail, zfail, zpass); -} - -void API_ENTRY(glTexCoordPointer)( GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glTexCoordPointer, size, type, stride, pointer); -} - -void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) { - CALL_GL_API(glTexEnvf, target, pname, param); -} - -void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) { - CALL_GL_API(glTexEnvfv, target, pname, params); -} - -void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) { - CALL_GL_API(glTexEnvx, target, pname, param); -} - -void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) { - CALL_GL_API(glTexEnvxv, target, pname, params); -} - -void API_ENTRY(glTexImage2D)( GLenum target, GLint level, GLint internalformat, - GLsizei width, GLsizei height, GLint border, GLenum format, - GLenum type, const GLvoid *pixels) { - CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, - border, format, type, pixels); -} - -void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) { - CALL_GL_API(glTexParameterf, target, pname, param); -} - -void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) { - CALL_GL_API(glTexParameterx, target, pname, param); -} - -void API_ENTRY(glTexSubImage2D)( GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid *pixels) { - CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, - width, height, format, type, pixels); -} - -void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glTranslatef, x, y, z); -} - -void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) { - CALL_GL_API(glTranslatex, x, y, z); -} - -void API_ENTRY(glVertexPointer)( GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glVertexPointer, size, type, stride, pointer); -} - -void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) { - CALL_GL_API(glViewport, x, y, width, height); -} - -// ES 1.1 -void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) { - CALL_GL_API(glClipPlanef, plane, equation); -} -void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) { - CALL_GL_API(glClipPlanex, plane, equation); -} -void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) { - CALL_GL_API(glBindBuffer, target, buffer); -} -void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) { - CALL_GL_API(glBufferData, target, size, data, usage); -} -void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { - CALL_GL_API(glBufferSubData, target, offset, size, data); -} -void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) { - CALL_GL_API(glDeleteBuffers, n, buffers); -} -void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) { - CALL_GL_API(glGenBuffers, n, buffers); -} -void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) { - CALL_GL_API(glGetBooleanv, pname, params); -} -void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) { - CALL_GL_API(glGetFixedv, pname, params); -} -void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) { - CALL_GL_API(glGetFloatv, pname, params); -} -void API_ENTRY(glGetPointerv)(GLenum pname, void **params) { - CALL_GL_API(glGetPointerv, pname, params); -} -void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) { - CALL_GL_API(glGetBufferParameteriv, target, pname, params); -} -void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) { - CALL_GL_API(glGetClipPlanef, pname, eqn); -} -void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) { - CALL_GL_API(glGetClipPlanex, pname, eqn); -} -void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetLightxv, light, pname, params); -} -void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetLightfv, light, pname, params); -} -void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetMaterialxv, face, pname, params); -} -void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetMaterialfv, face, pname, params); -} -void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetTexEnvfv, env, pname, params); -} -void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) { - CALL_GL_API(glGetTexEnviv, env, pname, params); -} -void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetTexEnvxv, env, pname, params); -} -void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetTexParameterfv, target, pname, params); -} -void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) { - CALL_GL_API(glGetTexParameteriv, target, pname, params); -} -void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetTexParameterxv, target, pname, params); -} -GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) { - CALL_GL_API_RETURN(glIsBuffer, buffer); -} -GLboolean API_ENTRY(glIsEnabled)(GLenum cap) { - CALL_GL_API_RETURN(glIsEnabled, cap); -} -GLboolean API_ENTRY(glIsTexture)(GLuint texture) { - CALL_GL_API_RETURN(glIsTexture, texture); -} -void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) { - CALL_GL_API(glPointParameterf, pname, param); -} -void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) { - CALL_GL_API(glPointParameterfv, pname, params); -} -void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) { - CALL_GL_API(glPointParameterx, pname, param); -} -void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) { - CALL_GL_API(glPointParameterxv, pname, params); -} -void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - CALL_GL_API(glColor4ub, red, green, blue, alpha); -} -void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) { - CALL_GL_API(glTexEnvi, target, pname, param); -} -void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) { - CALL_GL_API(glTexEnviv, target, pname, params); -} - -void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) { - CALL_GL_API(glTexParameterfv, target, pname, params); -} - -void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) { - CALL_GL_API(glTexParameteriv, target, pname, params); -} - -void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) { - CALL_GL_API(glTexParameteri, target, pname, param); -} -void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) { - CALL_GL_API(glTexParameterxv, target, pname, params); -} -void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glPointSizePointerOES, type, stride, pointer); -} - -// Extensions -void API_ENTRY(glDrawTexsOES)(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) { - CALL_GL_API(glDrawTexsOES, x, y, z, w, h); -} -void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint w, GLint h) { - CALL_GL_API(glDrawTexiOES, x, y, z, w, h); -} -void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h) { - CALL_GL_API(glDrawTexfOES, x, y, z, w, h); -} -void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) { - CALL_GL_API(glDrawTexxOES, x, y, z, w, h); -} -void API_ENTRY(glDrawTexsvOES)(const GLshort* coords) { - CALL_GL_API(glDrawTexsvOES, coords); -} -void API_ENTRY(glDrawTexivOES)(const GLint* coords) { - CALL_GL_API(glDrawTexivOES, coords); -} -void API_ENTRY(glDrawTexfvOES)(const GLfloat* coords) { - CALL_GL_API(glDrawTexfvOES, coords); -} -void API_ENTRY(glDrawTexxvOES)(const GLfixed* coords) { - CALL_GL_API(glDrawTexxvOES, coords); -} -GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed* mantissa, GLint* exponent) { - CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent); -} diff --git a/opengl/libs/GLES_CM/gl_logger.cpp b/opengl/libs/GLES_CM/gl_logger.cpp deleted file mode 100644 index 27be5c9..0000000 --- a/opengl/libs/GLES_CM/gl_logger.cpp +++ /dev/null @@ -1,1060 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#define LOG_TAG "GLLogger" - -#include <ctype.h> -#include <string.h> -#include <errno.h> -#include <dlfcn.h> - -#include <sys/ioctl.h> - -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <GLES/gl.h> -#include <GLES/glext.h> - -#include <cutils/log.h> -#include <cutils/atomic.h> -#include <cutils/properties.h> - -#include <utils/String8.h> - -#include "gl_logger.h" - -#undef NELEM -#define NELEM(x) (sizeof(x)/sizeof(*(x))) - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -template<typename T> -static int binarySearch(T const sortedArray[], int first, int last, EGLint key) -{ - while (first <= last) { - int mid = (first + last) / 2; - if (key > sortedArray[mid].key) { - first = mid + 1; - } else if (key < sortedArray[mid].key) { - last = mid - 1; - } else { - return mid; - } - } - return -1; -} - -struct pair_t { - const char* name; - int key; -}; - -static const pair_t gEnumMap[] = { - #define GLENUM(NAME, VALUE) { #NAME, VALUE }, - #include "gl_enums.in" - #undef GLENUM -}; - -// ---------------------------------------------------------------------------- - -template<typename TYPE> -class GLLogValue { -public: - GLLogValue(TYPE value) : mValue(value) { } - const TYPE& getValue() const { return mValue; } - String8 toString() const { - return convertToString(mValue); - } -private: - const TYPE& mValue; - String8 convertToString(unsigned int v) const { - char buf[16]; - snprintf(buf, 16, "%u", v); - return String8(buf); - } - String8 convertToString(unsigned long v) const { - char buf[16]; - snprintf(buf, 16, "%lu", v); - return String8(buf); - } - String8 convertToString(int v) const { - char buf[16]; - snprintf(buf, 16, "%d", v); - return String8(buf); - } - String8 convertToString(long v) const { - char buf[16]; - snprintf(buf, 16, "%ld", v); - return String8(buf); - } - String8 convertToString(float v) const { - char buf[16]; - snprintf(buf, 16, "%f", v); - return String8(buf); - } - String8 convertToString(void const* v) const { - char buf[16]; - snprintf(buf, 16, "%p", v); - return String8(buf); - } -}; - -class GLLogEnum : public GLLogValue<GLenum> { -public: - GLLogEnum(GLenum v) : GLLogValue<GLenum>(v) { } - String8 toString() const { - GLenum v = getValue(); - int i = binarySearch<pair_t>(gEnumMap, 0, NELEM(gEnumMap)-1, v); - if (i >= 0) { - return String8(gEnumMap[i].name); - } else { - char buf[16]; - snprintf(buf, 16, "0x%04x", v); - return String8(buf); - } - } -}; - -class GLLogClearBitfield : public GLLogValue<GLbitfield> { -public: - GLLogClearBitfield(GLbitfield v) : GLLogValue<GLbitfield>(v) { } - String8 toString() const { - char buf[16]; - snprintf(buf, 16, "0x%08x", getValue()); - return String8(buf); - } -}; - -class GLLogBool : public GLLogValue<GLboolean> { -public: - GLLogBool(GLboolean v) : GLLogValue<GLboolean>(v) { } - String8 toString() const { - GLboolean v = getValue(); - if (v == GL_TRUE) return String8("GL_TRUE"); - if (v == GL_FALSE) return String8("GL_FALSE"); - return GLLogValue<GLboolean>::toString(); - } -}; - -class GLLogFixed : public GLLogValue<GLfixed> { -public: - GLLogFixed(GLfixed v) : GLLogValue<GLfixed>(v) { } - String8 toString() const { - char buf[16]; - snprintf(buf, 16, "0x%08x", getValue()); - return String8(buf); - } -}; - - -template <typename TYPE> -class GLLogBuffer : public GLLogValue<TYPE *> { -public: - GLLogBuffer(TYPE* buffer, size_t count = -1) - : GLLogValue<TYPE*>(buffer) - { // output buffer - } - GLLogBuffer(TYPE const* buffer, size_t count = -1) - : GLLogValue<TYPE*>(const_cast<TYPE*>(buffer)) - { // input buffer - } -}; - -class GLLog -{ -public: - GLLog(const char* name) : mNumParams(0) { - mString.append(name); - mString.append("("); - } - - ~GLLog() { - LOGD("%s);", mString.string()); - } - - GLLog& operator << (unsigned char v) { - return *this << GLLogValue<unsigned int>(v); - } - GLLog& operator << (short v) { - return *this << GLLogValue<unsigned int>(v); - } - GLLog& operator << (unsigned int v) { - return *this << GLLogValue<unsigned int>(v); - } - GLLog& operator << (int v) { - return *this << GLLogValue<int>(v); - } - GLLog& operator << (long v) { - return *this << GLLogValue<long>(v); - } - GLLog& operator << (unsigned long v) { - return *this << GLLogValue<unsigned long>(v); - } - GLLog& operator << (float v) { - return *this << GLLogValue<float>(v); - } - GLLog& operator << (const void* v) { - return *this << GLLogValue<const void* >(v); - } - - template <typename TYPE> - GLLog& operator << (const TYPE& rhs) { - if (mNumParams > 0) - mString.append(", "); - mString.append(rhs.toString()); - mNumParams++; - return *this; - } - - const String8& string() const { return mString; } -private: - GLLog(const GLLog&); - - String8 mString; - int mNumParams; -}; - -#define API_ENTRY(api) log_##api -#define CALL_GL_API(_x, ...) -#define CALL_GL_API_RETURN(_x, ...) return(0); - -void API_ENTRY(glActiveTexture)(GLenum texture) { - CALL_GL_API(glActiveTexture, texture); - GLLog("glActiveTexture") << GLLogEnum(texture); -} - -void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) { - CALL_GL_API(glAlphaFunc, func, ref); - GLLog("glAlphaFunc") << GLLogEnum(func) << ref; -} - -void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) { - CALL_GL_API(glAlphaFuncx, func, ref); - GLLog("glAlphaFuncx") << GLLogEnum(func) << GLLogFixed(ref); -} - -void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) { - CALL_GL_API(glBindTexture, target, texture); - GLLog("glBindTexture") << GLLogEnum(target) << texture; -} - -void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) { - CALL_GL_API(glBlendFunc, sfactor, dfactor); - GLLog("glBlendFunc") << GLLogEnum(sfactor) << GLLogEnum(dfactor); -} - -void API_ENTRY(glClear)(GLbitfield mask) { - CALL_GL_API(glClear, mask); - GLLog("glClear") << GLLogClearBitfield(mask); -} - -void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - CALL_GL_API(glClearColor, red, green, blue, alpha); - GLLog("glClearColor") << red << green << blue << alpha; -} - -void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { - CALL_GL_API(glClearColorx, red, green, blue, alpha); - GLLog("glClearColorx") << GLLogFixed(red) << GLLogFixed(green) << GLLogFixed(blue) << GLLogFixed(alpha); -} - -void API_ENTRY(glClearDepthf)(GLclampf depth) { - CALL_GL_API(glClearDepthf, depth); - GLLog("glClearDepthf") << depth; -} - -void API_ENTRY(glClearDepthx)(GLclampx depth) { - CALL_GL_API(glClearDepthx, depth); - GLLog("glClearDepthx") << GLLogFixed(depth); -} - -void API_ENTRY(glClearStencil)(GLint s) { - CALL_GL_API(glClearStencil, s); - GLLog("glClearStencil") << s; -} - -void API_ENTRY(glClientActiveTexture)(GLenum texture) { - CALL_GL_API(glClientActiveTexture, texture); - GLLog("glClientActiveTexture") << GLLogEnum(texture); -} - -void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - CALL_GL_API(glColor4f, red, green, blue, alpha); - GLLog("glColor4f") << red << green << blue << alpha; -} - -void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { - CALL_GL_API(glColor4x, red, green, blue, alpha); - GLLog("glColor4x") << GLLogFixed(red) << GLLogFixed(green) << GLLogFixed(blue) << GLLogFixed(alpha); -} - -void API_ENTRY(glColorMask)(GLboolean r, GLboolean g, GLboolean b, GLboolean a) { - CALL_GL_API(glColorMask, r, g, b, a); - GLLog("glColorMask") << GLLogBool(r) << GLLogBool(g) << GLLogBool(b) << GLLogBool(a); -} - -void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) -{ - CALL_GL_API(glColorPointer, size, type, stride, ptr); - GLLog("glColorPointer") << size << GLLogEnum(type) << stride << ptr; -} - -void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid *data) { - CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, - width, height, border, imageSize, data); - GLLog("glCompressedTexImage2D") - << GLLogEnum(target) << level << GLLogEnum(internalformat) - << width << height << border << imageSize << data; -} - -void API_ENTRY(glCompressedTexSubImage2D)( GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLsizei imageSize, - const GLvoid *data) { - CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, - width, height, format, imageSize, data); - GLLog("glCompressedTexSubImage2D") - << GLLogEnum(target) << level << xoffset << yoffset - << width << height << GLLogEnum(format) << imageSize << data; -} - -void API_ENTRY(glCopyTexImage2D)( GLenum target, GLint level, GLenum internalformat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border) { - CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y, - width, height, border); - GLLog("glCopyTexImage2D") - << GLLogEnum(target) << level << GLLogEnum(internalformat) - << x << y << width << height << border; -} - -void API_ENTRY(glCopyTexSubImage2D)( GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLint x, GLint y, GLsizei width, - GLsizei height) { - CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y, - width, height); - GLLog("glCopyTexSubImage2D") - << GLLogEnum(target) << level << xoffset << yoffset - << x << y << width << height; -} - -void API_ENTRY(glCullFace)(GLenum mode) { - CALL_GL_API(glCullFace, mode); - GLLog("glCullFace") << GLLogEnum(mode); -} - -void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) { - CALL_GL_API(glDeleteTextures, n, textures); - GLLog("glDeleteTextures") << n << GLLogBuffer<GLuint>(textures, n); -} - -void API_ENTRY(glDepthFunc)(GLenum func) { - CALL_GL_API(glDepthFunc, func); - GLLog("glDepthFunc") << GLLogEnum(func); -} - -void API_ENTRY(glDepthMask)(GLboolean flag) { - CALL_GL_API(glDepthMask, flag); - GLLog("glDepthMask") << GLLogBool(flag); -} - -void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) { - CALL_GL_API(glDepthRangef, zNear, zFar); - GLLog("glDepthRangef") << zNear << zFar; -} - -void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) { - CALL_GL_API(glDepthRangex, zNear, zFar); - GLLog("glDepthRangex") << GLLogFixed(zNear) << GLLogFixed(zFar); -} - -void API_ENTRY(glDisable)(GLenum cap) { - CALL_GL_API(glDisable, cap); - GLLog("glDisable") << GLLogEnum(cap); -} - -void API_ENTRY(glDisableClientState)(GLenum array) { - CALL_GL_API(glDisableClientState, array); - GLLog("glDisableClientState") << GLLogEnum(array); -} - -void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) { - CALL_GL_API(glDrawArrays, mode, first, count); - GLLog("glDrawArrays") << GLLogEnum(mode) << first << count; -} - -void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices) { - CALL_GL_API(glDrawElements, mode, count, type, indices); - GLLog log("glDrawElements"); - log << GLLogEnum(mode) << count << GLLogEnum(type); - if (type == GL_UNSIGNED_BYTE) { - log << GLLogBuffer<GLubyte>(static_cast<const GLubyte*>(indices), count); - } else { - log << GLLogBuffer<GLushort>(static_cast<const GLushort*>(indices), count); - } - log; -} - -void API_ENTRY(glEnable)(GLenum cap) { - CALL_GL_API(glEnable, cap); - GLLog("glEnable") << GLLogEnum(cap); -} - -void API_ENTRY(glEnableClientState)(GLenum array) { - CALL_GL_API(glEnableClientState, array); - GLLog("glEnableClientState") << GLLogEnum(array); -} - -void API_ENTRY(glFinish)(void) { - CALL_GL_API(glFinish); - GLLog("glFinish"); -} - -void API_ENTRY(glFlush)(void) { - CALL_GL_API(glFlush); - GLLog("glFlush"); -} - -void API_ENTRY(glFogf)(GLenum pname, GLfloat param) { - CALL_GL_API(glFogf, pname, param); - GLLog("glFogf") << GLLogEnum(pname) << param; -} - -void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) { - CALL_GL_API(glFogfv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glFogfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} - -void API_ENTRY(glFogx)(GLenum pname, GLfixed param) { - CALL_GL_API(glFogx, pname, param); - GLLog("glFogx") << GLLogEnum(pname) << GLLogFixed(param); -} - -void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) { - CALL_GL_API(glFogxv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glFogfx") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} - -void API_ENTRY(glFrontFace)(GLenum mode) { - CALL_GL_API(glFrontFace, mode); - GLLog("glFrontFace") << GLLogEnum(mode); - } - -void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat zNear, GLfloat zFar) { - CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar); - GLLog("glFrustumf") << left << right << bottom << top << zNear << zFar; -} - -void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right, - GLfixed bottom, GLfixed top, - GLfixed zNear, GLfixed zFar) { - CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar); - GLLog("glFrustumx") - << GLLogFixed(left) << GLLogFixed(right) - << GLLogFixed(bottom) << GLLogFixed(top) - << GLLogFixed(zNear) << GLLogFixed(zFar); -} - -void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) { - CALL_GL_API(glGenTextures, n, textures); - GLLog("glGenTextures") << n << GLLogBuffer<GLuint>(textures, n); -} - -GLenum API_ENTRY(glGetError)(void) { - GLLog("glGetError"); - CALL_GL_API_RETURN(glGetError); -} - -void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) { - CALL_GL_API(glGetIntegerv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetIntegerv") << GLLogEnum(pname) << GLLogBuffer<GLint>(params); -} - -const GLubyte * API_ENTRY(glGetString)(GLenum name) { - GLLog("glGetString") << GLLogEnum(name); - CALL_GL_API_RETURN(glGetString, name); -} - -void API_ENTRY(glHint)(GLenum target, GLenum mode) { - CALL_GL_API(glHint, target, mode); - GLLog("GLenum") << GLLogEnum(target) << GLLogEnum(mode); -} - -void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) { - CALL_GL_API(glLightModelf, pname, param); - GLLog("glLightModelf") << GLLogEnum(pname) << param; -} - -void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) { - CALL_GL_API(glLightModelfv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glLightModelfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} - -void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) { - CALL_GL_API(glLightModelx, pname, param); - GLLog("glLightModelx") << GLLogEnum(pname) << GLLogFixed(param); -} - -void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) { - CALL_GL_API(glLightModelxv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glLightModelxv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} - -void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) { - CALL_GL_API(glLightf, light, pname, param); - GLLog("glLightf") << GLLogEnum(light) << GLLogEnum(pname) << param; -} - -void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) { - CALL_GL_API(glLightfv, light, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glLightfv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} - -void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) { - CALL_GL_API(glLightx, light, pname, param); - GLLog("glLightx") << GLLogEnum(light) << GLLogEnum(pname) << GLLogFixed(param); -} - -void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) { - CALL_GL_API(glLightxv, light, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glLightxv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} - -void API_ENTRY(glLineWidth)(GLfloat width) { - CALL_GL_API(glLineWidth, width); - GLLog("glLineWidth") << width; -} - -void API_ENTRY(glLineWidthx)(GLfixed width) { - CALL_GL_API(glLineWidthx, width); - GLLog("glLineWidth") << GLLogFixed(width); -} - -void API_ENTRY(glLoadIdentity)(void) { - CALL_GL_API(glLoadIdentity); - GLLog("glLoadIdentity"); -} - -void API_ENTRY(glLoadMatrixf)(const GLfloat *m) { - CALL_GL_API(glLoadMatrixf, m); - GLLog("glLoadMatrixf") << GLLogBuffer<GLfloat>(m, 16); -} - -void API_ENTRY(glLoadMatrixx)(const GLfixed *m) { - CALL_GL_API(glLoadMatrixx, m); - GLLog("glLoadMatrixx") << GLLogBuffer<GLfixed>(m, 16); -} - -void API_ENTRY(glLogicOp)(GLenum opcode) { - CALL_GL_API(glLogicOp, opcode); - GLLog("glLogicOp") << GLLogEnum(opcode); -} - -void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) { - CALL_GL_API(glMaterialf, face, pname, param); - GLLog("glMaterialf") << GLLogEnum(face) << GLLogEnum(pname) << param; -} - -void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) { - CALL_GL_API(glMaterialfv, face, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glMaterialfv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} - -void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) { - CALL_GL_API(glMaterialx, face, pname, param); - GLLog("glMaterialx") << GLLogEnum(face) << GLLogEnum(pname) << GLLogFixed(param); -} - -void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) { - CALL_GL_API(glMaterialxv, face, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glMaterialxv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} - -void API_ENTRY(glMatrixMode)(GLenum mode) { - CALL_GL_API(glMatrixMode, mode); - GLLog("glMatrixMode") << GLLogEnum(mode); -} - -void API_ENTRY(glMultMatrixf)(const GLfloat *m) { - CALL_GL_API(glMultMatrixf, m); - GLLog("glMultMatrixf") << GLLogBuffer<GLfloat>(m, 16); -} - -void API_ENTRY(glMultMatrixx)(const GLfixed *m) { - CALL_GL_API(glMultMatrixx, m); - GLLog("glMultMatrixx") << GLLogBuffer<GLfixed>(m, 16); -} - -void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q); - GLLog("glMultiTexCoord4f") << GLLogEnum(target) << s << t << r << q; -} - -void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { - CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q); - GLLog("glMultiTexCoord4x") << GLLogEnum(target) - << GLLogFixed(s) << GLLogFixed(t) << GLLogFixed(r) << GLLogFixed(q); -} - -void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) { - CALL_GL_API(glNormal3f, nx, ny, nz); - GLLog("glNormal3f") << nx << ny << nz; -} - -void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) { - CALL_GL_API(glNormal3x, nx, ny, nz); - GLLog("glNormal3x") << GLLogFixed(nx) << GLLogFixed(ny) << GLLogFixed(nz); -} - -void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glNormalPointer, type, stride, pointer); - GLLog("glNormalPointer") << GLLogEnum(type) << stride << pointer; -} - -void API_ENTRY(glOrthof)( GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat zNear, GLfloat zFar) { - CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar); - GLLog("glOrthof") << left << right << bottom << top << zNear << zFar; -} - -void API_ENTRY(glOrthox)( GLfixed left, GLfixed right, - GLfixed bottom, GLfixed top, - GLfixed zNear, GLfixed zFar) { - CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar); - GLLog("glOrthox") << GLLogFixed(left) << GLLogFixed(right) - << GLLogFixed(bottom) << GLLogFixed(top) - << GLLogFixed(zNear) << GLLogFixed(zFar); -} - -void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) { - CALL_GL_API(glPixelStorei, pname, param); - GLLog("glPixelStorei") << GLLogEnum(pname) << param; -} - -void API_ENTRY(glPointSize)(GLfloat size) { - CALL_GL_API(glPointSize, size); - GLLog("glPointSize") << size; -} - -void API_ENTRY(glPointSizex)(GLfixed size) { - CALL_GL_API(glPointSizex, size); - GLLog("glPointSizex") << GLLogFixed(size); -} - -void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) { - CALL_GL_API(glPolygonOffset, factor, units); - GLLog("glPolygonOffset") << factor << units; -} - -void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) { - CALL_GL_API(glPolygonOffsetx, factor, units); - GLLog("glPolygonOffsetx") << GLLogFixed(factor) << GLLogFixed(units); -} - -void API_ENTRY(glPopMatrix)(void) { - CALL_GL_API(glPopMatrix); - GLLog("glPopMatrix"); -} - -void API_ENTRY(glPushMatrix)(void) { - CALL_GL_API(glPushMatrix); - GLLog("glPushMatrix"); -} - -void API_ENTRY(glReadPixels)( GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid *pixels) { - CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels); - // XXX: we need to compute the size of this buffer - GLLog("glReadPixels") << x << y << width << height << GLLogEnum(format) << GLLogEnum(type) - << GLLogBuffer<unsigned char>(static_cast<unsigned char *>(pixels)); -} - -void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glRotatef, angle, x, y, z); - GLLog("glRotatef") << angle << x << y << z; -} - -void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { - CALL_GL_API(glRotatex, angle, x, y, z); - GLLog("glRotatex") << GLLogFixed(angle) << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z); -} - -void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) { - CALL_GL_API(glSampleCoverage, value, invert); - GLLog("glSampleCoverage") << value << GLLogBool(invert); -} - -void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) { - CALL_GL_API(glSampleCoveragex, value, invert); - GLLog("glSampleCoveragex") << GLLogFixed(value) << GLLogBool(invert); -} - -void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glScalef, x, y, z); - GLLog("glScalef") << x << y << z; -} - -void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) { - CALL_GL_API(glScalex, x, y, z); - GLLog("glScalex") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z); -} - -void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) { - CALL_GL_API(glScissor, x, y, width, height); - GLLog("glScissor") << x << y << width << height; -} - -void API_ENTRY(glShadeModel)(GLenum mode) { - CALL_GL_API(glShadeModel, mode); - GLLog("glShadeModel") << GLLogEnum(mode); -} - -void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) { - CALL_GL_API(glStencilFunc, func, ref, mask); - GLLog("glStencilFunc") << GLLogEnum(func) << ref << mask; -} - -void API_ENTRY(glStencilMask)(GLuint mask) { - CALL_GL_API(glStencilMask, mask); - GLLog("glStencilMask") << mask; -} - -void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { - CALL_GL_API(glStencilOp, fail, zfail, zpass); - GLLog("glStencilOp") << GLLogEnum(fail) << GLLogEnum(zfail) << GLLogEnum(zpass); -} - -void API_ENTRY(glTexCoordPointer)( GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glTexCoordPointer, size, type, stride, pointer); - GLLog("glTexCoordPointer") << size << GLLogEnum(type) << stride << pointer; -} - -void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) { - CALL_GL_API(glTexEnvf, target, pname, param); - GLLog("glTexEnvf") << GLLogEnum(target) << GLLogEnum(pname) << param; -} - -void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) { - CALL_GL_API(glTexEnvfv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glTexEnvx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} - -void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) { - CALL_GL_API(glTexEnvx, target, pname, param); - GLLog("glTexEnvx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogFixed(param); -} - -void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) { - CALL_GL_API(glTexEnvxv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glTexEnvxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} - -void API_ENTRY(glTexImage2D)( GLenum target, GLint level, GLint internalformat, - GLsizei width, GLsizei height, GLint border, GLenum format, - GLenum type, const GLvoid *pixels) { - CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, - border, format, type, pixels); - GLLog("glTexImage2D") << GLLogEnum(target) << level << GLLogEnum(internalformat) - << width << height << border << GLLogEnum(format) << GLLogEnum(type) - << GLLogBuffer<unsigned char>( static_cast<const unsigned char *>(pixels)); -} - -void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) { - CALL_GL_API(glTexParameterf, target, pname, param); - GLLog("glTexParameterf") << GLLogEnum(target) << GLLogEnum(pname) << param; -} - -void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) { - CALL_GL_API(glTexParameterx, target, pname, param); - GLLog("glTexParameterx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogFixed(param); -} - -void API_ENTRY(glTexSubImage2D)( GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid *pixels) { - CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, - width, height, format, type, pixels); - GLLog("glTexSubImage2D") << GLLogEnum(target) << level << xoffset << yoffset - << width << height << GLLogEnum(format) << GLLogEnum(type) - << GLLogBuffer<unsigned char>( static_cast<const unsigned char *>(pixels)); -} - -void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glTranslatef, x, y, z); - GLLog("glTranslatef") << x << y << z; -} - -void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) { - CALL_GL_API(glTranslatex, x, y, z); - GLLog("glTranslatex") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z); -} - -void API_ENTRY(glVertexPointer)( GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glVertexPointer, size, type, stride, pointer); - GLLog("glVertexPointer") << size << GLLogEnum(type) << stride << pointer; -} - -void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) { - CALL_GL_API(glViewport, x, y, width, height); - GLLog("glViewport") << x << y << width << height; -} - -// ES 1.1 -void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) { - CALL_GL_API(glClipPlanef, plane, equation); - GLLog("glClipPlanef") << GLLogEnum(plane) << GLLogBuffer<GLfloat>(equation, 4); -} -void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) { - CALL_GL_API(glClipPlanex, plane, equation); - GLLog("glClipPlanex") << GLLogEnum(plane) << GLLogBuffer<GLfixed>(equation, 4); -} -void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) { - CALL_GL_API(glBindBuffer, target, buffer); - GLLog("glBindBuffer") << GLLogEnum(target) << buffer; -} -void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) { - CALL_GL_API(glBufferData, target, size, data, usage); - GLLog("glBufferData") << GLLogEnum(target) << size - << GLLogBuffer<unsigned char>(static_cast<const unsigned char*>(data), size); -} -void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { - CALL_GL_API(glBufferSubData, target, offset, size, data); - GLLog("glBufferSubData") << GLLogEnum(target) << offset << size - << GLLogBuffer<unsigned char>(static_cast<const unsigned char*>(data), size); -} -void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) { - CALL_GL_API(glDeleteBuffers, n, buffers); - GLLog("glDeleteBuffers") << n << GLLogBuffer<GLuint>(buffers, n); -} -void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) { - CALL_GL_API(glGenBuffers, n, buffers); - GLLog("glGenBuffers") << n << GLLogBuffer<GLuint>(buffers, n); -} -void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) { - CALL_GL_API(glGetBooleanv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetBooleanv") << GLLogEnum(pname) << GLLogBuffer<GLboolean>(params); -} -void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) { - CALL_GL_API(glGetFixedv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetFixedv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) { - CALL_GL_API(glGetFloatv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetFloatv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} -void API_ENTRY(glGetPointerv)(GLenum pname, void **params) { - CALL_GL_API(glGetPointerv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetPointerv") << GLLogEnum(pname) << GLLogBuffer<void*>(params); -} -void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) { - // XXX: we need to compute the size of this buffer - CALL_GL_API(glGetBufferParameteriv, target, pname, params); - GLLog("glGetBufferParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params); -} -void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) { - CALL_GL_API(glGetClipPlanef, pname, eqn); - GLLog("glGetClipPlanef") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(eqn, 4); -} -void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) { - CALL_GL_API(glGetClipPlanex, pname, eqn); - GLLog("glGetClipPlanex") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(eqn, 4); -} -void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetLightxv, light, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetLightxv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetLightfv, light, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetLightfv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} -void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetMaterialxv, face, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetMaterialxv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetMaterialfv, face, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetMaterialfv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} -void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetTexEnvfv, env, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetTexEnvfv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} -void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) { - CALL_GL_API(glGetTexEnviv, env, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetTexEnviv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLint>(params); -} -void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetTexEnvxv, env, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetTexEnvxv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) { - CALL_GL_API(glGetTexParameterfv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetTexParameterfv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} -void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) { - CALL_GL_API(glGetTexParameteriv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetTexParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params); -} -void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) { - CALL_GL_API(glGetTexParameterxv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glGetTexParameterxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) { - GLLog("glIsBuffer") << buffer; - CALL_GL_API_RETURN(glIsBuffer, buffer); -} -GLboolean API_ENTRY(glIsEnabled)(GLenum cap) { - GLLog("glIsEnabled") << GLLogEnum(cap); - CALL_GL_API_RETURN(glIsEnabled, cap); -} -GLboolean API_ENTRY(glIsTexture)(GLuint texture) { - GLLog("glIsTexture") << texture; - CALL_GL_API_RETURN(glIsTexture, texture); -} -void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) { - CALL_GL_API(glPointParameterf, pname, param); - GLLog("glPointParameterf") << GLLogEnum(pname) << param; -} -void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) { - CALL_GL_API(glPointParameterfv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glPointParameterfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} -void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) { - CALL_GL_API(glPointParameterx, pname, param); - GLLog("glPointParameterx") << GLLogEnum(pname) << GLLogFixed(param); -} -void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) { - CALL_GL_API(glPointParameterxv, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glPointParameterxv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - CALL_GL_API(glColor4ub, red, green, blue, alpha); - GLLog("glColor4ub") << red << green << blue << alpha; -} -void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) { - CALL_GL_API(glTexEnvi, target, pname, param); - GLLog("glTexEnvi") << GLLogEnum(target) << GLLogEnum(pname) << param; -} -void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) { - CALL_GL_API(glTexEnviv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glTexEnviv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params); -} - -void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) { - CALL_GL_API(glTexParameterfv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glTexParameterfv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params); -} - -void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) { - CALL_GL_API(glTexParameteriv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glTexParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params); -} - -void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) { - CALL_GL_API(glTexParameteri, target, pname, param); - GLLog("glTexParameteri") << GLLogEnum(target) << GLLogEnum(pname) << param; -} -void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) { - CALL_GL_API(glTexParameterxv, target, pname, params); - // XXX: we need to compute the size of this buffer - GLLog("glTexParameterxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params); -} -void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) { - CALL_GL_API(glPointSizePointerOES, type, stride, pointer); - GLLog("glPointSizePointerOES") << GLLogEnum(type) << stride << pointer; -} - -// Extensions -void API_ENTRY(glDrawTexsOES)(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) { - CALL_GL_API(glDrawTexsOES, x, y, z, w, h); - GLLog("glDrawTexsOES") << x << y << z << w << h; -} -void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint w, GLint h) { - CALL_GL_API(glDrawTexiOES, x, y, z, w, h); - GLLog("glDrawTexiOES") << x << y << z << w << h; -} -void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h) { - CALL_GL_API(glDrawTexfOES, x, y, z, w, h); - GLLog("glDrawTexfOES") << x << y << z << w << h; -} -void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) { - CALL_GL_API(glDrawTexxOES, x, y, z, w, h); - GLLog("glDrawTexfOES") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z) << GLLogFixed(w) << GLLogFixed(h); -} -void API_ENTRY(glDrawTexsvOES)(const GLshort* coords) { - CALL_GL_API(glDrawTexsvOES, coords); - GLLog("glDrawTexsvOES") << GLLogBuffer<GLshort>(coords, 5); -} -void API_ENTRY(glDrawTexivOES)(const GLint* coords) { - CALL_GL_API(glDrawTexivOES, coords); - GLLog("glDrawTexivOES") << GLLogBuffer<GLint>(coords, 5); -} -void API_ENTRY(glDrawTexfvOES)(const GLfloat* coords) { - CALL_GL_API(glDrawTexfvOES, coords); - GLLog("glDrawTexfvOES") << GLLogBuffer<GLfloat>(coords, 5); -} -void API_ENTRY(glDrawTexxvOES)(const GLfixed* coords) { - CALL_GL_API(glDrawTexxvOES, coords); - GLLog("glDrawTexxvOES") << GLLogBuffer<GLfixed>(coords, 5); -} -GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed* mantissa, GLint* exponent) { - GLLog("glQueryMatrixxOES") << GLLogBuffer<GLfixed>(mantissa, 16) << GLLogBuffer<GLfixed>(exponent, 16); - CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent); -} - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- diff --git a/opengl/libs/egl_entries.in b/opengl/libs/egl_entries.in deleted file mode 100644 index 33b4c65..0000000 --- a/opengl/libs/egl_entries.in +++ /dev/null @@ -1,45 +0,0 @@ -EGL_ENTRY(EGLDisplay, eglGetDisplay, NativeDisplayType) -EGL_ENTRY(EGLBoolean, eglInitialize, EGLDisplay, EGLint*, EGLint*) -EGL_ENTRY(EGLBoolean, eglTerminate, EGLDisplay) -EGL_ENTRY(EGLBoolean, eglGetConfigs, EGLDisplay, EGLConfig*, EGLint, EGLint*) -EGL_ENTRY(EGLBoolean, eglChooseConfig, EGLDisplay, const EGLint *, EGLConfig *, EGLint, EGLint *) - -EGL_ENTRY(EGLBoolean, eglGetConfigAttrib, EGLDisplay, EGLConfig, EGLint, EGLint *) -EGL_ENTRY(EGLSurface, eglCreateWindowSurface, EGLDisplay, EGLConfig, NativeWindowType, const EGLint *) -EGL_ENTRY(EGLSurface, eglCreatePixmapSurface, EGLDisplay, EGLConfig, NativePixmapType, const EGLint *) -EGL_ENTRY(EGLSurface, eglCreatePbufferSurface, EGLDisplay, EGLConfig, const EGLint *) -EGL_ENTRY(EGLBoolean, eglDestroySurface, EGLDisplay, EGLSurface) -EGL_ENTRY(EGLBoolean, eglQuerySurface, EGLDisplay, EGLSurface, EGLint, EGLint *) -EGL_ENTRY(EGLContext, eglCreateContext, EGLDisplay, EGLConfig, EGLContext, const EGLint *) -EGL_ENTRY(EGLBoolean, eglDestroyContext, EGLDisplay, EGLContext) -EGL_ENTRY(EGLBoolean, eglMakeCurrent, EGLDisplay, EGLSurface, EGLSurface, EGLContext) -EGL_ENTRY(EGLContext, eglGetCurrentContext, void) -EGL_ENTRY(EGLSurface, eglGetCurrentSurface, EGLint) -EGL_ENTRY(EGLDisplay, eglGetCurrentDisplay, void) -EGL_ENTRY(EGLBoolean, eglQueryContext, EGLDisplay, EGLContext, EGLint, EGLint *) -EGL_ENTRY(EGLBoolean, eglWaitGL, void) -EGL_ENTRY(EGLBoolean, eglWaitNative, EGLint) -EGL_ENTRY(EGLBoolean, eglSwapBuffers, EGLDisplay, EGLSurface) -EGL_ENTRY(EGLBoolean, eglCopyBuffers, EGLDisplay, EGLSurface, NativePixmapType) -EGL_ENTRY(EGLint, eglGetError, void) -EGL_ENTRY(const char*, eglQueryString, EGLDisplay, EGLint) -EGL_ENTRY(__eglMustCastToProperFunctionPointerType, eglGetProcAddress, const char *) - -/* EGL 1.1 */ - -EGL_ENTRY(EGLBoolean, eglSurfaceAttrib, EGLDisplay, EGLSurface, EGLint, EGLint) -EGL_ENTRY(EGLBoolean, eglBindTexImage, EGLDisplay, EGLSurface, EGLint) -EGL_ENTRY(EGLBoolean, eglReleaseTexImage, EGLDisplay, EGLSurface, EGLint) -EGL_ENTRY(EGLBoolean, eglSwapInterval, EGLDisplay, EGLint) - -/* EGL 1.2 */ - -EGL_ENTRY(EGLBoolean, eglBindAPI, EGLenum) -EGL_ENTRY(EGLenum, eglQueryAPI, void) -EGL_ENTRY(EGLBoolean, eglWaitClient, void) -EGL_ENTRY(EGLBoolean, eglReleaseThread, void) -EGL_ENTRY(EGLSurface, eglCreatePbufferFromClientBuffer, EGLDisplay, EGLenum, EGLClientBuffer, EGLConfig, const EGLint *) - -/* EGL 1.3 */ - -/* EGL 1.4 */ diff --git a/opengl/libs/egl_impl.h b/opengl/libs/egl_impl.h deleted file mode 100644 index 62ce3fc..0000000 --- a/opengl/libs/egl_impl.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#ifndef ANDROID_EGL_IMPL_H -#define ANDROID_EGL_IMPL_H - -#include <ctype.h> - -#include <EGL/egl.h> - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -struct gl_hooks_t; - -struct egl_connection_t -{ - void volatile * dso; - gl_hooks_t * hooks; - EGLint major; - EGLint minor; - int unavailable; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- - -#endif /* ANDROID_EGL_IMPL_H */ diff --git a/opengl/libs/gl_entries.in b/opengl/libs/gl_entries.in deleted file mode 100644 index b97e8fe..0000000 --- a/opengl/libs/gl_entries.in +++ /dev/null @@ -1,159 +0,0 @@ -GL_ENTRY(void, glColor4f, GLfloat, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glColor4x, GLfixed, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glNormal3f, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glNormal3x, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glCullFace, GLenum) -GL_ENTRY(void, glFrontFace, GLenum) -GL_ENTRY(void, glDisable, GLenum) -GL_ENTRY(void, glEnable, GLenum) -GL_ENTRY(void, glFinish, void) -GL_ENTRY(void, glFlush, void) -GL_ENTRY(GLenum, glGetError, void) -GL_ENTRY(const GLubyte*, glGetString, GLenum) -GL_ENTRY(void, glGetIntegerv, GLenum, GLint *) -GL_ENTRY(void, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean) -GL_ENTRY(void, glDepthMask, GLboolean) -GL_ENTRY(void, glStencilMask, GLuint) -GL_ENTRY(void, glDepthFunc, GLenum) -GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar) -GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar) -GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units) -GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units) -GL_ENTRY(void, glLogicOp, GLenum opcode) -GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref) -GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref) -GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor) -GL_ENTRY(void, glClear, GLbitfield mask) -GL_ENTRY(void, glClearColor, GLclampf r, GLclampf g, GLclampf b, GLclampf a) -GL_ENTRY(void, glClearColorx, GLclampx r, GLclampx g, GLclampx b, GLclampx a) -GL_ENTRY(void, glClearDepthf, GLclampf depth) -GL_ENTRY(void, glClearDepthx, GLclampx depth) -GL_ENTRY(void, glClearStencil, GLint s) -GL_ENTRY(void, glPointSize, GLfloat) -GL_ENTRY(void, glPointSizex, GLfixed) -GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert) -GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert) -GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask) -GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass) -GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glHint, GLenum, GLenum mode) -GL_ENTRY(void, glLineWidth, GLfloat width) -GL_ENTRY(void, glLineWidthx, GLfixed width) -GL_ENTRY(void, glShadeModel, GLenum) -GL_ENTRY(void, glLightModelf, GLenum, GLfloat) -GL_ENTRY(void, glLightModelfv, GLenum, const GLfloat *) -GL_ENTRY(void, glLightModelx, GLenum, GLfixed) -GL_ENTRY(void, glLightModelxv, GLenum, const GLfixed *) -GL_ENTRY(void, glLightf, GLenum, GLenum, GLfloat) -GL_ENTRY(void, glLightfv, GLenum, GLenum, const GLfloat *) -GL_ENTRY(void, glLightx, GLenum, GLenum, GLfixed) -GL_ENTRY(void, glLightxv, GLenum, GLenum, const GLfixed *) -GL_ENTRY(void, glMaterialf, GLenum, GLenum, GLfloat) -GL_ENTRY(void, glMaterialfv, GLenum, GLenum, const GLfloat *) -GL_ENTRY(void, glMaterialx, GLenum, GLenum, GLfixed) -GL_ENTRY(void, glMaterialxv, GLenum, GLenum, const GLfixed *) -GL_ENTRY(void, glFogf, GLenum, GLfloat) -GL_ENTRY(void, glFogfv, GLenum, const GLfloat *) -GL_ENTRY(void, glFogx, GLenum, GLfixed) -GL_ENTRY(void, glFogxv, GLenum, const GLfixed *) -GL_ENTRY(void, glVertexPointer, GLint, GLenum, GLsizei, const GLvoid *) -GL_ENTRY(void, glColorPointer, GLint, GLenum, GLsizei, const GLvoid *) -GL_ENTRY(void, glNormalPointer, GLenum, GLsizei, const GLvoid *) -GL_ENTRY(void, glTexCoordPointer, GLint, GLenum, GLsizei, const GLvoid *) -GL_ENTRY(void, glEnableClientState, GLenum) -GL_ENTRY(void, glDisableClientState, GLenum) -GL_ENTRY(void, glClientActiveTexture, GLenum) -GL_ENTRY(void, glDrawArrays, GLenum, GLint first, GLsizei) -GL_ENTRY(void, glDrawElements, GLenum, GLsizei, GLenum, const GLvoid *) -GL_ENTRY(void, glLoadIdentity, void) -GL_ENTRY(void, glLoadMatrixf, const GLfloat*) -GL_ENTRY(void, glLoadMatrixx, const GLfixed*) -GL_ENTRY(void, glMatrixMode, GLenum mode) -GL_ENTRY(void, glMultMatrixf, const GLfloat*) -GL_ENTRY(void, glMultMatrixx, const GLfixed*) -GL_ENTRY(void, glPopMatrix, void) -GL_ENTRY(void, glPushMatrix, void) -GL_ENTRY(void, glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glRotatef, GLfloat, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glRotatex, GLfixed, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glScalef, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glScalex, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glTranslatef, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glTranslatex, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glViewport, GLint, GLint, GLsizei, GLsizei) -GL_ENTRY(void, glActiveTexture, GLenum) -GL_ENTRY(void, glBindTexture, GLenum, GLuint) -GL_ENTRY(void, glGenTextures, GLsizei, GLuint*) -GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *) -GL_ENTRY(void, glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glPixelStorei, GLenum, GLint) -GL_ENTRY(void, glTexEnvf, GLenum, GLenum, GLfloat) -GL_ENTRY(void, glTexEnvfv, GLenum, GLenum, const GLfloat*) -GL_ENTRY(void, glTexEnvx, GLenum, GLenum, GLfixed) -GL_ENTRY(void, glTexEnvxv, GLenum, GLenum, const GLfixed*) -GL_ENTRY(void, glTexParameterf, GLenum, GLenum, GLfloat) -GL_ENTRY(void, glTexParameterx, GLenum, GLenum, GLfixed) -GL_ENTRY(void, glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*) -GL_ENTRY(void, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*) -GL_ENTRY(void, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) -GL_ENTRY(void, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) -GL_ENTRY(void, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*) -GL_ENTRY(void, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*) -GL_ENTRY(void, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *) - -// 1.1 additions -GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat*) -GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed*) -GL_ENTRY(void, glBindBuffer, GLenum, GLuint) -GL_ENTRY(void, glBufferData, GLenum, GLsizeiptr, const GLvoid*, GLenum) -GL_ENTRY(void, glBufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid*) -GL_ENTRY(void, glDeleteBuffers, GLsizei, const GLuint*) -GL_ENTRY(void, glGenBuffers, GLsizei, GLuint*) -GL_ENTRY(void, glGetBooleanv, GLenum, GLboolean *) -GL_ENTRY(void, glGetFixedv, GLenum, GLfixed *) -GL_ENTRY(void, glGetFloatv, GLenum, GLfloat *) -GL_ENTRY(void, glGetPointerv, GLenum, void **) -GL_ENTRY(void, glGetBufferParameteriv, GLenum, GLenum, GLint *) -GL_ENTRY(void, glGetClipPlanef, GLenum, GLfloat[4]) -GL_ENTRY(void, glGetClipPlanex, GLenum, GLfixed[4]) -GL_ENTRY(void, glGetLightxv, GLenum, GLenum, GLfixed *) -GL_ENTRY(void, glGetLightfv, GLenum, GLenum, GLfloat *) -GL_ENTRY(void, glGetMaterialxv, GLenum, GLenum, GLfixed *) -GL_ENTRY(void, glGetMaterialfv, GLenum, GLenum, GLfloat *) -GL_ENTRY(void, glGetTexEnvfv, GLenum, GLenum, GLfloat *) -GL_ENTRY(void, glGetTexEnviv, GLenum, GLenum, GLint *) -GL_ENTRY(void, glGetTexEnvxv, GLenum, GLenum, GLfixed *) -GL_ENTRY(void, glGetTexParameterfv, GLenum, GLenum, GLfloat *) -GL_ENTRY(void, glGetTexParameteriv, GLenum, GLenum, GLint *) -GL_ENTRY(void, glGetTexParameterxv, GLenum, GLenum, GLfixed *) -GL_ENTRY(GLboolean, glIsBuffer, GLuint) -GL_ENTRY(GLboolean, glIsEnabled, GLenum) -GL_ENTRY(GLboolean, glIsTexture, GLuint) -GL_ENTRY(void, glPointParameterf, GLenum, GLfloat) -GL_ENTRY(void, glPointParameterfv, GLenum, const GLfloat *) -GL_ENTRY(void, glPointParameterx, GLenum, GLfixed) -GL_ENTRY(void, glPointParameterxv, GLenum, const GLfixed *) -GL_ENTRY(void, glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte) -GL_ENTRY(void, glTexEnvi, GLenum, GLenum, GLint) -GL_ENTRY(void, glTexEnviv, GLenum, GLenum, const GLint *) -GL_ENTRY(void, glTexParameterfv, GLenum, GLenum, const GLfloat *) -GL_ENTRY(void, glTexParameteriv, GLenum, GLenum, const GLint *) -GL_ENTRY(void, glTexParameteri, GLenum, GLenum, GLint) -GL_ENTRY(void, glTexParameterxv, GLenum, GLenum, const GLfixed *) -GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid*) - -// Extensions -GL_ENTRY(void, glDrawTexsOES, GLshort, GLshort, GLshort, GLshort, GLshort) -GL_ENTRY(void, glDrawTexiOES, GLint, GLint, GLint, GLint, GLint) -GL_ENTRY(void, glDrawTexfOES, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat) -GL_ENTRY(void, glDrawTexxOES, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed) -GL_ENTRY(void, glDrawTexsvOES, const GLshort*) -GL_ENTRY(void, glDrawTexivOES, const GLint*) -GL_ENTRY(void, glDrawTexfvOES, const GLfloat*) -GL_ENTRY(void, glDrawTexxvOES, const GLfixed*) -GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed* mantissa, GLint* exponent) - diff --git a/opengl/libs/gl_enums.in b/opengl/libs/gl_enums.in deleted file mode 100644 index ffc2fad..0000000 --- a/opengl/libs/gl_enums.in +++ /dev/null @@ -1,261 +0,0 @@ -GLENUM(GL_POINTS, 0x0000) -GLENUM(GL_LINES, 0x0001) -GLENUM(GL_LINE_LOOP, 0x0002) -GLENUM(GL_LINE_STRIP, 0x0003) -GLENUM(GL_TRIANGLES, 0x0004) -GLENUM(GL_TRIANGLE_STRIP, 0x0005) -GLENUM(GL_TRIANGLE_FAN, 0x0006) -GLENUM(GL_ADD, 0x0104) -GLENUM(GL_NEVER, 0x0200) -GLENUM(GL_LESS, 0x0201) -GLENUM(GL_EQUAL, 0x0202) -GLENUM(GL_LEQUAL, 0x0203) -GLENUM(GL_GREATER, 0x0204) -GLENUM(GL_NOTEQUAL, 0x0205) -GLENUM(GL_GEQUAL, 0x0206) -GLENUM(GL_ALWAYS, 0x0207) -GLENUM(GL_SRC_COLOR, 0x0300) -GLENUM(GL_ONE_MINUS_SRC_COLOR, 0x0301) -GLENUM(GL_SRC_ALPHA, 0x0302) -GLENUM(GL_ONE_MINUS_SRC_ALPHA, 0x0303) -GLENUM(GL_DST_ALPHA, 0x0304) -GLENUM(GL_ONE_MINUS_DST_ALPHA, 0x0305) -GLENUM(GL_DST_COLOR, 0x0306) -GLENUM(GL_ONE_MINUS_DST_COLOR, 0x0307) -GLENUM(GL_SRC_ALPHA_SATURATE, 0x0308) -GLENUM(GL_FRONT, 0x0404) -GLENUM(GL_BACK, 0x0405) -GLENUM(GL_FRONT_AND_BACK, 0x0408) -GLENUM(GL_INVALID_ENUM, 0x0500) -GLENUM(GL_INVALID_VALUE, 0x0501) -GLENUM(GL_INVALID_OPERATION, 0x0502) -GLENUM(GL_STACK_OVERFLOW, 0x0503) -GLENUM(GL_STACK_UNDERFLOW, 0x0504) -GLENUM(GL_OUT_OF_MEMORY, 0x0505) -GLENUM(GL_EXP, 0x0800) -GLENUM(GL_EXP2, 0x0801) -GLENUM(GL_CW, 0x0900) -GLENUM(GL_CCW, 0x0901) -GLENUM(GL_POINT_SMOOTH, 0x0B10) -GLENUM(GL_SMOOTH_POINT_SIZE_RANGE, 0x0B12) -GLENUM(GL_LINE_SMOOTH, 0x0B20) -GLENUM(GL_SMOOTH_LINE_WIDTH_RANGE, 0x0B22) -GLENUM(GL_CULL_FACE, 0x0B44) -GLENUM(GL_LIGHTING, 0x0B50) -GLENUM(GL_LIGHT_MODEL_TWO_SIDE, 0x0B52) -GLENUM(GL_LIGHT_MODEL_AMBIENT, 0x0B53) -GLENUM(GL_COLOR_MATERIAL, 0x0B57) -GLENUM(GL_FOG, 0x0B60) -GLENUM(GL_FOG_DENSITY, 0x0B62) -GLENUM(GL_FOG_START, 0x0B63) -GLENUM(GL_FOG_END, 0x0B64) -GLENUM(GL_FOG_MODE, 0x0B65) -GLENUM(GL_FOG_COLOR, 0x0B66) -GLENUM(GL_DEPTH_TEST, 0x0B71) -GLENUM(GL_STENCIL_TEST, 0x0B90) -GLENUM(GL_NORMALIZE, 0x0BA1) -GLENUM(GL_ALPHA_TEST, 0x0BC0) -GLENUM(GL_DITHER, 0x0BD0) -GLENUM(GL_BLEND, 0x0BE2) -GLENUM(GL_COLOR_LOGIC_OP, 0x0BF2) -GLENUM(GL_SCISSOR_TEST, 0x0C11) -GLENUM(GL_PERSPECTIVE_CORRECTION_HINT, 0x0C50) -GLENUM(GL_POINT_SMOOTH_HINT, 0x0C51) -GLENUM(GL_LINE_SMOOTH_HINT, 0x0C52) -GLENUM(GL_POLYGON_SMOOTH_HINT, 0x0C53) -GLENUM(GL_FOG_HINT, 0x0C54) -GLENUM(GL_UNPACK_ALIGNMENT, 0x0CF5) -GLENUM(GL_PACK_ALIGNMENT, 0x0D05) -GLENUM(GL_MAX_LIGHTS, 0x0D31) -GLENUM(GL_MAX_CLIP_PLANES, 0x0D32) -GLENUM(GL_MAX_TEXTURE_SIZE, 0x0D33) -GLENUM(GL_MAX_MODELVIEW_STACK_DEPTH, 0x0D36) -GLENUM(GL_MAX_PROJECTION_STACK_DEPTH, 0x0D38) -GLENUM(GL_MAX_TEXTURE_STACK_DEPTH, 0x0D39) -GLENUM(GL_MAX_VIEWPORT_DIMS, 0x0D3A) -GLENUM(GL_RED_BITS, 0x0D52) -GLENUM(GL_GREEN_BITS, 0x0D53) -GLENUM(GL_BLUE_BITS, 0x0D54) -GLENUM(GL_ALPHA_BITS, 0x0D55) -GLENUM(GL_DEPTH_BITS, 0x0D56) -GLENUM(GL_STENCIL_BITS, 0x0D57) -GLENUM(GL_TEXTURE_2D, 0x0DE1) -GLENUM(GL_DONT_CARE, 0x1100) -GLENUM(GL_FASTEST, 0x1101) -GLENUM(GL_NICEST, 0x1102) -GLENUM(GL_AMBIENT, 0x1200) -GLENUM(GL_DIFFUSE, 0x1201) -GLENUM(GL_SPECULAR, 0x1202) -GLENUM(GL_POSITION, 0x1203) -GLENUM(GL_SPOT_DIRECTION, 0x1204) -GLENUM(GL_SPOT_EXPONENT, 0x1205) -GLENUM(GL_SPOT_CUTOFF, 0x1206) -GLENUM(GL_CONSTANT_ATTENUATION, 0x1207) -GLENUM(GL_LINEAR_ATTENUATION, 0x1208) -GLENUM(GL_QUADRATIC_ATTENUATION, 0x1209) -GLENUM(GL_BYTE, 0x1400) -GLENUM(GL_UNSIGNED_BYTE, 0x1401) -GLENUM(GL_SHORT, 0x1402) -GLENUM(GL_UNSIGNED_SHORT, 0x1403) -GLENUM(GL_FLOAT, 0x1406) -GLENUM(GL_FIXED, 0x140C) -GLENUM(GL_CLEAR, 0x1500) -GLENUM(GL_AND, 0x1501) -GLENUM(GL_AND_REVERSE, 0x1502) -GLENUM(GL_COPY, 0x1503) -GLENUM(GL_AND_INVERTED, 0x1504) -GLENUM(GL_NOOP, 0x1505) -GLENUM(GL_XOR, 0x1506) -GLENUM(GL_OR, 0x1507) -GLENUM(GL_NOR, 0x1508) -GLENUM(GL_EQUIV, 0x1509) -GLENUM(GL_INVERT, 0x150A) -GLENUM(GL_OR_REVERSE, 0x150B) -GLENUM(GL_COPY_INVERTED, 0x150C) -GLENUM(GL_OR_INVERTED, 0x150D) -GLENUM(GL_NAND, 0x150E) -GLENUM(GL_SET, 0x150F) -GLENUM(GL_EMISSION, 0x1600) -GLENUM(GL_SHININESS, 0x1601) -GLENUM(GL_AMBIENT_AND_DIFFUSE, 0x1602) -GLENUM(GL_MODELVIEW, 0x1700) -GLENUM(GL_PROJECTION, 0x1701) -GLENUM(GL_TEXTURE, 0x1702) -GLENUM(GL_ALPHA, 0x1906) -GLENUM(GL_RGB, 0x1907) -GLENUM(GL_RGBA, 0x1908) -GLENUM(GL_LUMINANCE, 0x1909) -GLENUM(GL_LUMINANCE_ALPHA, 0x190A) -GLENUM(GL_FLAT, 0x1D00) -GLENUM(GL_SMOOTH, 0x1D01) -GLENUM(GL_KEEP, 0x1E00) -GLENUM(GL_REPLACE, 0x1E01) -GLENUM(GL_REPLACE, 0x1E01) -GLENUM(GL_INCR, 0x1E02) -GLENUM(GL_DECR, 0x1E03) -GLENUM(GL_VENDOR, 0x1F00) -GLENUM(GL_RENDERER, 0x1F01) -GLENUM(GL_VERSION, 0x1F02) -GLENUM(GL_EXTENSIONS, 0x1F03) -GLENUM(GL_MODULATE, 0x2100) -GLENUM(GL_DECAL, 0x2101) -GLENUM(GL_TEXTURE_ENV_MODE, 0x2200) -GLENUM(GL_TEXTURE_ENV_COLOR, 0x2201) -GLENUM(GL_TEXTURE_ENV, 0x2300) -GLENUM(GL_NEAREST, 0x2600) -GLENUM(GL_LINEAR, 0x2601) -GLENUM(GL_NEAREST_MIPMAP_NEAREST, 0x2700) -GLENUM(GL_LINEAR_MIPMAP_NEAREST, 0x2701) -GLENUM(GL_NEAREST_MIPMAP_LINEAR, 0x2702) -GLENUM(GL_LINEAR_MIPMAP_LINEAR, 0x2703) -GLENUM(GL_TEXTURE_MAG_FILTER, 0x2800) -GLENUM(GL_TEXTURE_MIN_FILTER, 0x2801) -GLENUM(GL_TEXTURE_WRAP_S, 0x2802) -GLENUM(GL_TEXTURE_WRAP_T, 0x2803) -GLENUM(GL_CLAMP, 0x2900) -GLENUM(GL_REPEAT, 0x2901) -GLENUM(GL_CLIP_PLANE0, 0x3000) -GLENUM(GL_CLIP_PLANE1, 0x3001) -GLENUM(GL_CLIP_PLANE2, 0x3002) -GLENUM(GL_CLIP_PLANE3, 0x3003) -GLENUM(GL_CLIP_PLANE4, 0x3004) -GLENUM(GL_CLIP_PLANE5, 0x3005) -GLENUM(GL_LIGHT0, 0x4000) -GLENUM(GL_LIGHT1, 0x4001) -GLENUM(GL_LIGHT2, 0x4002) -GLENUM(GL_LIGHT3, 0x4003) -GLENUM(GL_LIGHT4, 0x4004) -GLENUM(GL_LIGHT5, 0x4005) -GLENUM(GL_LIGHT6, 0x4006) -GLENUM(GL_LIGHT7, 0x4007) -GLENUM(GL_DIRECT_TEXTURE_2D_QUALCOMM, 0x7E80) -GLENUM(GL_UNSIGNED_SHORT_4_4_4_4, 0x8033) -GLENUM(GL_UNSIGNED_SHORT_5_5_5_1, 0x8034) -GLENUM(GL_POLYGON_OFFSET_FILL, 0x8037) -GLENUM(GL_RESCALE_NORMAL, 0x803A) -GLENUM(GL_VERTEX_ARRAY, 0x8074) -GLENUM(GL_NORMAL_ARRAY, 0x8075) -GLENUM(GL_COLOR_ARRAY, 0x8076) -GLENUM(GL_TEXTURE_COORD_ARRAY, 0x8078) -GLENUM(GL_MULTISAMPLE, 0x809D) -GLENUM(GL_SAMPLE_ALPHA_TO_COVERAGE, 0x809E) -GLENUM(GL_SAMPLE_ALPHA_TO_ONE, 0x809F) -GLENUM(GL_SAMPLE_COVERAGE, 0x80A0) -GLENUM(GL_MAX_ELEMENTS_VERTICES, 0x80E8) -GLENUM(GL_MAX_ELEMENTS_INDICES, 0x80E9) -GLENUM(GL_CLAMP_TO_EDGE, 0x812F) -GLENUM(GL_GENERATE_MIPMAP, 0x8191) -GLENUM(GL_GENERATE_MIPMAP_HINT, 0x8192) -GLENUM(GL_UNSIGNED_SHORT_5_6_5, 0x8363) -GLENUM(GL_ALIASED_POINT_SIZE_RANGE, 0x846D) -GLENUM(GL_ALIASED_LINE_WIDTH_RANGE, 0x846E) -GLENUM(GL_TEXTURE0, 0x84C0) -GLENUM(GL_TEXTURE1, 0x84C1) -GLENUM(GL_TEXTURE2, 0x84C2) -GLENUM(GL_TEXTURE3, 0x84C3) -GLENUM(GL_TEXTURE4, 0x84C4) -GLENUM(GL_TEXTURE5, 0x84C5) -GLENUM(GL_TEXTURE6, 0x84C6) -GLENUM(GL_TEXTURE7, 0x84C7) -GLENUM(GL_TEXTURE8, 0x84C8) -GLENUM(GL_TEXTURE9, 0x84C9) -GLENUM(GL_TEXTURE10, 0x84CA) -GLENUM(GL_TEXTURE11, 0x84CB) -GLENUM(GL_TEXTURE12, 0x84CC) -GLENUM(GL_TEXTURE13, 0x84CD) -GLENUM(GL_TEXTURE14, 0x84CE) -GLENUM(GL_TEXTURE15, 0x84CF) -GLENUM(GL_TEXTURE16, 0x84D0) -GLENUM(GL_TEXTURE17, 0x84D1) -GLENUM(GL_TEXTURE18, 0x84D2) -GLENUM(GL_TEXTURE19, 0x84D3) -GLENUM(GL_TEXTURE20, 0x84D4) -GLENUM(GL_TEXTURE21, 0x84D5) -GLENUM(GL_TEXTURE22, 0x84D6) -GLENUM(GL_TEXTURE23, 0x84D7) -GLENUM(GL_TEXTURE24, 0x84D8) -GLENUM(GL_TEXTURE25, 0x84D9) -GLENUM(GL_TEXTURE26, 0x84DA) -GLENUM(GL_TEXTURE27, 0x84DB) -GLENUM(GL_TEXTURE28, 0x84DC) -GLENUM(GL_TEXTURE29, 0x84DD) -GLENUM(GL_TEXTURE30, 0x84DE) -GLENUM(GL_TEXTURE31, 0x84DF) -GLENUM(GL_MAX_TEXTURE_UNITS, 0x84E2) -GLENUM(GL_NUM_COMPRESSED_TEXTURE_FORMATS, 0x86A2) -GLENUM(GL_COMPRESSED_TEXTURE_FORMATS, 0x86A3) -GLENUM(GL_BUFFER_SIZE, 0x8764) -GLENUM(GL_BUFFER_USAGE, 0x8765) -GLENUM(GL_POINT_SPRITE_OES, 0x8861) -GLENUM(GL_COORD_REPLACE_OES, 0x8862) -GLENUM(GL_ARRAY_BUFFER, 0x8892) -GLENUM(GL_ELEMENT_ARRAY_BUFFER, 0x8893) -GLENUM(GL_ARRAY_BUFFER_BINDING, 0x8894) -GLENUM(GL_ELEMENT_ARRAY_BUFFER_BINDING, 0x8895) -GLENUM(GL_VERTEX_ARRAY_BUFFER_BINDING, 0x8896) -GLENUM(GL_NORMAL_ARRAY_BUFFER_BINDING, 0x8897) -GLENUM(GL_COLOR_ARRAY_BUFFER_BINDING, 0x8898) -GLENUM(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING, 0x889A) -GLENUM(GL_STATIC_DRAW, 0x88E4) -GLENUM(GL_DYNAMIC_DRAW, 0x88E8) -GLENUM(GL_POINT_SIZE_ARRAY_TYPE_OES, 0x898A) -GLENUM(GL_POINT_SIZE_ARRAY_STRIDE_OES, 0x898B) -GLENUM(GL_POINT_SIZE_ARRAY_POINTER_OES, 0x898C) -GLENUM(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES, 0x898D) -GLENUM(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES, 0x898E) -GLENUM(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES, 0x898F) -GLENUM(GL_PALETTE4_RGB8_OES, 0x8B90) -GLENUM(GL_PALETTE4_RGBA8_OES, 0x8B91) -GLENUM(GL_PALETTE4_R5_G6_B5_OES, 0x8B92) -GLENUM(GL_PALETTE4_RGBA4_OES, 0x8B93) -GLENUM(GL_PALETTE4_RGB5_A1_OES, 0x8B94) -GLENUM(GL_PALETTE8_RGB8_OES, 0x8B95) -GLENUM(GL_PALETTE8_RGBA8_OES, 0x8B96) -GLENUM(GL_PALETTE8_R5_G6_B5_OES, 0x8B97) -GLENUM(GL_PALETTE8_RGBA4_OES, 0x8B98) -GLENUM(GL_PALETTE8_RGB5_A1_OES, 0x8B99) -GLENUM(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, 0x8B9A) -GLENUM(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, 0x8B9B) -GLENUM(GL_POINT_SIZE_ARRAY_OES, 0x8B9C) -GLENUM(GL_TEXTURE_CROP_RECT_OES, 0x8B9D) -GLENUM(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES, 0x8B9F) diff --git a/opengl/libs/gl_logger.h b/opengl/libs/gl_logger.h deleted file mode 100644 index ce85dd1..0000000 --- a/opengl/libs/gl_logger.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#ifndef ANDROID_GL_LOGGER_H -#define ANDROID_GL_LOGGER_H - -namespace android { -#define GL_ENTRY(r, api, ...) r log_##api(__VA_ARGS__); -#include "gl_entries.in" -#undef GL_ENTRY -}; // namespace android - -#endif /* ANDROID_GL_LOGGER_H */ diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h deleted file mode 100644 index 63fb017..0000000 --- a/opengl/libs/hooks.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - ** Copyright 2007, The Android Open Source Project - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#ifndef ANDROID_GLES_CM_HOOKS_H -#define ANDROID_GLES_CM_HOOKS_H - -#include <ctype.h> -#include <string.h> -#include <errno.h> - -#include <EGL/egl.h> -#include <GLES/gl.h> - -#define GL_LOGGER 0 -#if !defined(__arm__) -#define USE_SLOW_BINDING 1 -#else -#define USE_SLOW_BINDING 0 -#endif -#undef NELEM -#define NELEM(x) (sizeof(x)/sizeof(*(x))) -#define MAX_NUMBER_OF_GL_EXTENSIONS 32 - - -#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && !GL_LOGGER && __OPTIMIZE__ -#define USE_FAST_TLS_KEY 1 -#else -#define USE_FAST_TLS_KEY 0 -#endif - -#if USE_FAST_TLS_KEY -# include <bionic_tls.h> /* special private C library header */ -#endif - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -// EGLDisplay are global, not attached to a given thread -const unsigned int NUM_DISPLAYS = 1; - -enum { - IMPL_HARDWARE = 0, - IMPL_SOFTWARE, - IMPL_CONTEXT_LOST, - IMPL_NO_CONTEXT, - - IMPL_NUM_IMPLEMENTATIONS -}; - -// ---------------------------------------------------------------------------- - -// GL / EGL hooks - -#undef GL_ENTRY -#undef EGL_ENTRY -#define GL_ENTRY(_r, _api, ...) _r (*_api)(__VA_ARGS__); -#define EGL_ENTRY(_r, _api, ...) _r (*_api)(__VA_ARGS__); - -struct gl_hooks_t { - struct gl_t { - #include "gl_entries.in" - } gl; - struct egl_t { - #include "egl_entries.in" - } egl; - struct gl_ext_t { - void (*extensions[MAX_NUMBER_OF_GL_EXTENSIONS])(void); - } ext; -}; -#undef GL_ENTRY -#undef EGL_ENTRY - - -// ---------------------------------------------------------------------------- - -extern gl_hooks_t gHooks[IMPL_NUM_IMPLEMENTATIONS]; -extern pthread_key_t gGLWrapperKey; - -#if USE_FAST_TLS_KEY - -// We have a dedicated TLS slot in bionic -static inline gl_hooks_t const * volatile * get_tls_hooks() { - volatile void *tls_base = __get_tls(); - gl_hooks_t const * volatile * tls_hooks = - reinterpret_cast<gl_hooks_t const * volatile *>(tls_base); - return tls_hooks; -} - -static inline void setGlThreadSpecific(gl_hooks_t const *value) { - gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); - tls_hooks[TLS_SLOT_OPENGL_API] = value; -} - -static gl_hooks_t const* getGlThreadSpecific() { - gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); - gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; - if (hooks) return hooks; - return &gHooks[IMPL_NO_CONTEXT]; -} - -#else - -static inline void setGlThreadSpecific(gl_hooks_t const *value) { - pthread_setspecific(gGLWrapperKey, value); -} - -static gl_hooks_t const* getGlThreadSpecific() { - gl_hooks_t const* hooks = static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey)); - if (hooks) return hooks; - return &gHooks[IMPL_NO_CONTEXT]; -} - -#endif - - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- - -#endif /* ANDROID_GLES_CM_HOOKS_H */ diff --git a/opengl/libs/tools/enumextract.sh b/opengl/libs/tools/enumextract.sh deleted file mode 100644 index 5707302..0000000 --- a/opengl/libs/tools/enumextract.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -awk ' -/^#define GL_/ { - names[count] = $2; - values[count] = $3; - sort[count] = $3 + 0; - count++; -} -END { - for (i = 1; i < count; i++) { - for (j = 0; j < i; j++) { - if (sort[i] < sort[j]) { - tn = names[i]; - tv = values[i]; - ts = sort[i]; - names[i] = names[j]; - values[i] = values[j]; - sort[i] = sort[j]; - names[j] = tn; - values[j] = tv; - sort[j] = ts; - } - } - } - - for (i = 0; i < count; i++) { - printf("GLENUM(%s, %s)\n", names[i], values[i]); - } -} -' < $1 - |