Merge change 462 into donut
* changes: integrate some OpenGL ES changes back from master_gl in preparation of opening GLES to the NDK.
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
/*
|
||||
**
|
||||
** 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
|
||||
** 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
|
||||
** 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
|
||||
** 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.
|
||||
*/
|
||||
|
||||
@@ -478,22 +478,38 @@ struct extention_map_t {
|
||||
};
|
||||
|
||||
static const extention_map_t gExtentionMap[] = {
|
||||
{ "glDrawTexsOES", (void(*)())&glDrawTexsOES },
|
||||
{ "glDrawTexiOES", (void(*)())&glDrawTexiOES },
|
||||
{ "glDrawTexfOES", (void(*)())&glDrawTexfOES },
|
||||
{ "glDrawTexxOES", (void(*)())&glDrawTexxOES },
|
||||
{ "glDrawTexsvOES", (void(*)())&glDrawTexsvOES },
|
||||
{ "glDrawTexivOES", (void(*)())&glDrawTexivOES },
|
||||
{ "glDrawTexfvOES", (void(*)())&glDrawTexfvOES },
|
||||
{ "glDrawTexxvOES", (void(*)())&glDrawTexxvOES },
|
||||
{ "glQueryMatrixxOES", (void(*)())&glQueryMatrixxOES },
|
||||
{ "glClipPlanef", (void(*)())&glClipPlanef },
|
||||
{ "glClipPlanex", (void(*)())&glClipPlanex },
|
||||
{ "glBindBuffer", (void(*)())&glBindBuffer },
|
||||
{ "glBufferData", (void(*)())&glBufferData },
|
||||
{ "glBufferSubData", (void(*)())&glBufferSubData },
|
||||
{ "glDeleteBuffers", (void(*)())&glDeleteBuffers },
|
||||
{ "glGenBuffers", (void(*)())&glGenBuffers },
|
||||
{ "glDrawTexsOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexsOES },
|
||||
{ "glDrawTexiOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexiOES },
|
||||
{ "glDrawTexfOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexfOES },
|
||||
{ "glDrawTexxOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexxOES },
|
||||
{ "glDrawTexsvOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES },
|
||||
{ "glDrawTexivOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexivOES },
|
||||
{ "glDrawTexfvOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES },
|
||||
{ "glDrawTexxvOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES },
|
||||
{ "glQueryMatrixxOES",
|
||||
(__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES },
|
||||
{ "glClipPlanef",
|
||||
(__eglMustCastToProperFunctionPointerType)&glClipPlanef },
|
||||
{ "glClipPlanex",
|
||||
(__eglMustCastToProperFunctionPointerType)&glClipPlanex },
|
||||
{ "glBindBuffer",
|
||||
(__eglMustCastToProperFunctionPointerType)&glBindBuffer },
|
||||
{ "glBufferData",
|
||||
(__eglMustCastToProperFunctionPointerType)&glBufferData },
|
||||
{ "glBufferSubData",
|
||||
(__eglMustCastToProperFunctionPointerType)&glBufferSubData },
|
||||
{ "glDeleteBuffers",
|
||||
(__eglMustCastToProperFunctionPointerType)&glDeleteBuffers },
|
||||
{ "glGenBuffers",
|
||||
(__eglMustCastToProperFunctionPointerType)&glGenBuffers },
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1299,6 +1315,8 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: call connect / disconnect on the surface
|
||||
|
||||
ogles_context_t* gl = (ogles_context_t*)ctx;
|
||||
if (makeCurrent(gl) == 0) {
|
||||
if (ctx) {
|
||||
|
||||
@@ -35,7 +35,6 @@ include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
GLES_CM/gl.cpp.arm \
|
||||
GLES_CM/gl_logger.cpp \
|
||||
#
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libcutils libutils libui libEGL
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "GLLogger"
|
||||
#define LOG_TAG "libEGL"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@@ -69,9 +69,9 @@ private:
|
||||
|
||||
struct egl_display_t : public egl_object_t<'_dpy'>
|
||||
{
|
||||
EGLDisplay dpys[2];
|
||||
EGLConfig* configs[2];
|
||||
EGLint numConfigs[2];
|
||||
EGLDisplay dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
|
||||
EGLConfig* configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
|
||||
EGLint numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
|
||||
EGLint numTotalConfigs;
|
||||
char const* extensionsString;
|
||||
volatile int32_t refs;
|
||||
@@ -81,7 +81,7 @@ struct egl_display_t : public egl_object_t<'_dpy'>
|
||||
char const * clientApi;
|
||||
char const * extensions;
|
||||
};
|
||||
strings_t queryString[2];
|
||||
strings_t queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
|
||||
};
|
||||
|
||||
struct egl_surface_t : public egl_object_t<'_srf'>
|
||||
@@ -156,7 +156,7 @@ static char const * const egl_names[] = {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
egl_connection_t gEGLImpl[2];
|
||||
egl_connection_t gEGLImpl[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
|
||||
static egl_display_t gDisplay[NUM_DISPLAYS];
|
||||
static pthread_mutex_t gThreadLocalStorageKeyMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_key_t gEGLThreadLocalStorageKey = -1;
|
||||
@@ -278,29 +278,56 @@ void *load_driver(const char* driver, gl_hooks_t* hooks)
|
||||
driver, dlerror());
|
||||
|
||||
if (dso) {
|
||||
void** curr;
|
||||
// first find the symbol for eglGetProcAddress
|
||||
|
||||
typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)(
|
||||
const char*);
|
||||
|
||||
getProcAddressType getProcAddress =
|
||||
(getProcAddressType)dlsym(dso, "eglGetProcAddress");
|
||||
|
||||
LOGE_IF(!getProcAddress,
|
||||
"can't find eglGetProcAddress() in %s", driver);
|
||||
|
||||
__eglMustCastToProperFunctionPointerType* curr;
|
||||
char const * const * api;
|
||||
gl_hooks_t::gl_t* gl = &hooks->gl;
|
||||
curr = (void**)gl;
|
||||
api = gl_names;
|
||||
|
||||
gl_hooks_t::egl_t* egl = &hooks->egl;
|
||||
curr = (__eglMustCastToProperFunctionPointerType*)egl;
|
||||
api = egl_names;
|
||||
while (*api) {
|
||||
void* f = dlsym(dso, *api);
|
||||
//LOGD("<%s> @ 0x%p", *api, f);
|
||||
char const * name = *api;
|
||||
__eglMustCastToProperFunctionPointerType f =
|
||||
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
|
||||
if (f == NULL) {
|
||||
//LOGW("<%s> not found in %s", *api, driver);
|
||||
f = (void*)gl_unimplemented;
|
||||
// couldn't find the entry-point, use eglGetProcAddress()
|
||||
f = getProcAddress(name);
|
||||
if (f == NULL) {
|
||||
f = (__eglMustCastToProperFunctionPointerType)0;
|
||||
}
|
||||
}
|
||||
*curr++ = f;
|
||||
api++;
|
||||
}
|
||||
gl_hooks_t::egl_t* egl = &hooks->egl;
|
||||
curr = (void**)egl;
|
||||
api = egl_names;
|
||||
|
||||
gl_hooks_t::gl_t* gl = &hooks->gl;
|
||||
curr = (__eglMustCastToProperFunctionPointerType*)gl;
|
||||
api = gl_names;
|
||||
while (*api) {
|
||||
void* f = dlsym(dso, *api);
|
||||
char const * name = *api;
|
||||
// if the function starts with '__' it's a special case that
|
||||
// uses a wrapper. skip the '__' when looking into the real lib.
|
||||
if (name[0] == '_' && name[1] == '_') {
|
||||
name += 2;
|
||||
}
|
||||
__eglMustCastToProperFunctionPointerType f =
|
||||
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
|
||||
if (f == NULL) {
|
||||
//LOGW("<%s> not found in %s", *api, driver);
|
||||
f = (void*)0;
|
||||
// couldn't find the entry-point, use eglGetProcAddress()
|
||||
f = getProcAddress(name);
|
||||
if (f == NULL) {
|
||||
f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
|
||||
}
|
||||
}
|
||||
*curr++ = f;
|
||||
api++;
|
||||
@@ -429,18 +456,19 @@ egl_display_t* get_display(EGLDisplay dpy)
|
||||
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;
|
||||
template<typename NATIVE, typename EGL>
|
||||
static inline NATIVE* egl_to_native_cast(EGL arg) {
|
||||
return reinterpret_cast<NATIVE*>(arg);
|
||||
}
|
||||
|
||||
static inline
|
||||
egl_context_t* get_context(EGLContext context)
|
||||
{
|
||||
egl_context_t* c = (egl_context_t *)context;
|
||||
return c;
|
||||
egl_surface_t* get_surface(EGLSurface surface) {
|
||||
return egl_to_native_cast<egl_surface_t>(surface);
|
||||
}
|
||||
|
||||
static inline
|
||||
egl_context_t* get_context(EGLContext context) {
|
||||
return egl_to_native_cast<egl_context_t>(context);
|
||||
}
|
||||
|
||||
static egl_connection_t* validate_display_config(
|
||||
@@ -451,7 +479,7 @@ static egl_connection_t* validate_display_config(
|
||||
if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL);
|
||||
|
||||
impl = uintptr_t(config)>>24;
|
||||
if (uint32_t(impl) >= 2) {
|
||||
if (uint32_t(impl) >= IMPL_NUM_DRIVERS_IMPLEMENTATIONS) {
|
||||
return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
|
||||
}
|
||||
index = uintptr_t(config) & 0xFFFFFF;
|
||||
@@ -491,13 +519,8 @@ static EGLBoolean validate_display_surface(EGLDisplay dpy, EGLSurface surface)
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
}; // namespace android
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
using namespace android;
|
||||
|
||||
EGLDisplay eglGetDisplay(NativeDisplayType display)
|
||||
EGLDisplay egl_init_displays(NativeDisplayType display)
|
||||
{
|
||||
if (sEarlyInitState) {
|
||||
return EGL_NO_DISPLAY;
|
||||
@@ -510,7 +533,7 @@ EGLDisplay eglGetDisplay(NativeDisplayType 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];
|
||||
@@ -573,6 +596,18 @@ EGLDisplay eglGetDisplay(NativeDisplayType display)
|
||||
return dpy;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
}; // namespace android
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
using namespace android;
|
||||
|
||||
EGLDisplay eglGetDisplay(NativeDisplayType display)
|
||||
{
|
||||
return egl_init_displays(display);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialization
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -594,7 +629,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
// build our own extension string first, based on the extension we know
|
||||
// and the extension supported by our client implementation
|
||||
dp->extensionsString = strdup(gExtensionString);
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
cnx->major = -1;
|
||||
cnx->minor = -1;
|
||||
@@ -624,7 +659,7 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
}
|
||||
|
||||
EGLBoolean res = EGL_FALSE;
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso && cnx->major>=0 && cnx->minor>=0) {
|
||||
EGLint n;
|
||||
@@ -663,7 +698,7 @@ EGLBoolean eglTerminate(EGLDisplay dpy)
|
||||
return EGL_TRUE;
|
||||
|
||||
EGLBoolean res = EGL_FALSE;
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
cnx->hooks->egl.eglTerminate(dp->dpys[i]);
|
||||
@@ -706,7 +741,7 @@ EGLBoolean eglGetConfigs( EGLDisplay dpy,
|
||||
return EGL_TRUE;
|
||||
}
|
||||
GLint n = 0;
|
||||
for (int j=0 ; j<2 ; j++) {
|
||||
for (int j=0 ; j<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; j++) {
|
||||
for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) {
|
||||
*configs++ = MAKE_CONFIG(j, i);
|
||||
config_size--;
|
||||
@@ -794,7 +829,7 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
|
||||
return res;
|
||||
}
|
||||
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
if (cnx->hooks->egl.eglChooseConfig(
|
||||
@@ -1107,7 +1142,7 @@ EGLBoolean eglWaitNative(EGLint engine)
|
||||
EGLint eglGetError(void)
|
||||
{
|
||||
EGLint result = EGL_SUCCESS;
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
EGLint err = EGL_SUCCESS;
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso)
|
||||
@@ -1120,8 +1155,15 @@ EGLint eglGetError(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
void (*eglGetProcAddress(const char *procname))()
|
||||
__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
|
||||
{
|
||||
// eglGetProcAddress() could be the very first function called
|
||||
// in which case we must make sure we've initialized ourselves, this
|
||||
// happens the first time egl_get_display() is called.
|
||||
|
||||
if (egl_init_displays(EGL_DEFAULT_DISPLAY) == EGL_NO_DISPLAY)
|
||||
return NULL;
|
||||
|
||||
__eglMustCastToProperFunctionPointerType addr;
|
||||
addr = findProcAddress(procname, gExtentionMap, NELEM(gExtentionMap));
|
||||
if (addr) return addr;
|
||||
@@ -1133,7 +1175,7 @@ void (*eglGetProcAddress(const char *procname))()
|
||||
|
||||
addr = 0;
|
||||
int slot = -1;
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
if (cnx->hooks->egl.eglGetProcAddress) {
|
||||
@@ -1266,7 +1308,7 @@ EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
|
||||
if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
|
||||
|
||||
EGLBoolean res = EGL_TRUE;
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
if (cnx->hooks->egl.eglSwapInterval) {
|
||||
@@ -1309,7 +1351,7 @@ EGLBoolean eglBindAPI(EGLenum api)
|
||||
{
|
||||
// bind this API on all EGLs
|
||||
EGLBoolean res = EGL_TRUE;
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
if (cnx->hooks->egl.eglBindAPI) {
|
||||
@@ -1324,7 +1366,7 @@ EGLBoolean eglBindAPI(EGLenum api)
|
||||
|
||||
EGLenum eglQueryAPI(void)
|
||||
{
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
if (cnx->hooks->egl.eglQueryAPI) {
|
||||
@@ -1340,7 +1382,7 @@ EGLenum eglQueryAPI(void)
|
||||
|
||||
EGLBoolean eglReleaseThread(void)
|
||||
{
|
||||
for (int i=0 ; i<2 ; i++) {
|
||||
for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
|
||||
egl_connection_t* const cnx = &gEGLImpl[i];
|
||||
if (cnx->dso) {
|
||||
if (cnx->hooks->egl.eglReleaseThread) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include "hooks.h"
|
||||
#include "egl_impl.h"
|
||||
|
||||
using namespace android;
|
||||
|
||||
@@ -57,13 +58,6 @@ void glVertexPointerBounds(GLint size, GLenum type,
|
||||
// Actual GL entry-points
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if GL_LOGGER
|
||||
# include "gl_logger.h"
|
||||
# define GL_LOGGER_IMPL(_x) _x
|
||||
#else
|
||||
# define GL_LOGGER_IMPL(_x)
|
||||
#endif
|
||||
|
||||
#undef API_ENTRY
|
||||
#undef CALL_GL_API
|
||||
#undef CALL_GL_API_RETURN
|
||||
@@ -96,16 +90,15 @@ void glVertexPointerBounds(GLint size, GLenum type,
|
||||
|
||||
#define CALL_GL_API(_api, ...) \
|
||||
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
|
||||
GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); ) \
|
||||
_c->_api(__VA_ARGS__)
|
||||
|
||||
#define CALL_GL_API_RETURN(_api, ...) \
|
||||
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
|
||||
GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); ) \
|
||||
return _c->_api(__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include "gl_api.in"
|
||||
}
|
||||
@@ -114,3 +107,18 @@ extern "C" {
|
||||
#undef CALL_GL_API
|
||||
#undef CALL_GL_API_RETURN
|
||||
|
||||
|
||||
/*
|
||||
* These GL calls are special because they need to EGL to retrieve some
|
||||
* informations before they can execute.
|
||||
*/
|
||||
|
||||
|
||||
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
|
||||
{
|
||||
}
|
||||
|
||||
void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -43,3 +43,10 @@ EGL_ENTRY(EGLSurface, eglCreatePbufferFromClientBuffer, EGLDisplay, EGLenum, EGL
|
||||
/* EGL 1.3 */
|
||||
|
||||
/* EGL 1.4 */
|
||||
|
||||
/* EGL_EGLEXT_VERSION 3 */
|
||||
|
||||
EGL_ENTRY(EGLBoolean, eglLockSurfaceKHR, EGLDisplay, EGLSurface, const EGLint *)
|
||||
EGL_ENTRY(EGLBoolean, eglUnlockSurfaceKHR, EGLDisplay, EGLSurface)
|
||||
EGL_ENTRY(EGLImageKHR, eglCreateImageKHR, EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *)
|
||||
EGL_ENTRY(EGLBoolean, eglDestroyImageKHR, EGLDisplay, EGLImageKHR)
|
||||
|
||||
@@ -15,30 +15,30 @@ 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, glDepthRangef, GLclampf, GLclampf)
|
||||
GL_ENTRY(void, glDepthRangex, GLclampx, GLclampx)
|
||||
GL_ENTRY(void, glPolygonOffset, GLfloat, GLfloat)
|
||||
GL_ENTRY(void, glPolygonOffsetx, GLfixed, GLfixed)
|
||||
GL_ENTRY(void, glLogicOp, GLenum)
|
||||
GL_ENTRY(void, glAlphaFuncx, GLenum, GLclampx)
|
||||
GL_ENTRY(void, glAlphaFunc, GLenum, GLclampf)
|
||||
GL_ENTRY(void, glBlendFunc, GLenum, GLenum)
|
||||
GL_ENTRY(void, glClear, GLbitfield)
|
||||
GL_ENTRY(void, glClearColor, GLclampf, GLclampf, GLclampf, GLclampf)
|
||||
GL_ENTRY(void, glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx)
|
||||
GL_ENTRY(void, glClearDepthf, GLclampf)
|
||||
GL_ENTRY(void, glClearDepthx, GLclampx)
|
||||
GL_ENTRY(void, glClearStencil, GLint)
|
||||
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, glSampleCoverage, GLclampf, GLboolean)
|
||||
GL_ENTRY(void, glSampleCoveragex, GLclampx, GLboolean)
|
||||
GL_ENTRY(void, glStencilFunc, GLenum, GLint, GLuint)
|
||||
GL_ENTRY(void, glStencilOp, GLenum, GLenum, GLenum)
|
||||
GL_ENTRY(void, glScissor, GLint, GLint, GLsizei, GLsizei)
|
||||
GL_ENTRY(void, glHint, GLenum, GLenum)
|
||||
GL_ENTRY(void, glLineWidth, GLfloat)
|
||||
GL_ENTRY(void, glLineWidthx, GLfixed)
|
||||
GL_ENTRY(void, glShadeModel, GLenum)
|
||||
GL_ENTRY(void, glLightModelf, GLenum, GLfloat)
|
||||
GL_ENTRY(void, glLightModelfv, GLenum, const GLfloat *)
|
||||
@@ -63,12 +63,12 @@ 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, glDrawArrays, GLenum, GLint, 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, glMatrixMode, GLenum)
|
||||
GL_ENTRY(void, glMultMatrixf, const GLfloat*)
|
||||
GL_ENTRY(void, glMultMatrixx, const GLfixed*)
|
||||
GL_ENTRY(void, glPopMatrix, void)
|
||||
@@ -87,7 +87,7 @@ 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, glDeleteTextures, GLsizei, 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)
|
||||
@@ -106,8 +106,8 @@ GL_ENTRY(void, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, G
|
||||
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, glClipPlanef, GLenum, const GLfloat*)
|
||||
GL_ENTRY(void, glClipPlanex, GLenum, 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*)
|
||||
@@ -144,7 +144,7 @@ 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*)
|
||||
GL_ENTRY(void, glPointSizePointerOES, GLenum, GLsizei, const GLvoid*)
|
||||
|
||||
// Extensions
|
||||
GL_ENTRY(void, glDrawTexsOES, GLshort, GLshort, GLshort, GLshort, GLshort)
|
||||
@@ -155,5 +155,40 @@ 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)
|
||||
|
||||
GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed*, GLint*)
|
||||
GL_ENTRY(void, __glEGLImageTargetTexture2DOES, GLenum, GLeglImageOES)
|
||||
GL_ENTRY(void, __glEGLImageTargetRenderbufferStorageOES, GLenum, GLeglImageOES)
|
||||
GL_ENTRY(void, glBlendEquationSeparateOES, GLenum, GLenum)
|
||||
GL_ENTRY(void, glBlendFuncSeparateOES, GLenum, GLenum, GLenum, GLenum)
|
||||
GL_ENTRY(void, glBlendEquationOES, GLenum)
|
||||
GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint)
|
||||
GL_ENTRY(void, glBindRenderbufferOES, GLenum, GLuint)
|
||||
GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei, const GLuint*)
|
||||
GL_ENTRY(void, glGenRenderbuffersOES, GLsizei, GLuint*)
|
||||
GL_ENTRY(void, glRenderbufferStorageOES, GLenum, GLenum, GLsizei, GLsizei)
|
||||
GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum, GLenum, GLint*)
|
||||
GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint)
|
||||
GL_ENTRY(void, glBindFramebufferOES, GLenum, GLuint)
|
||||
GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei, const GLuint*)
|
||||
GL_ENTRY(void, glGenFramebuffersOES, GLsizei, GLuint*)
|
||||
GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum)
|
||||
GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum, GLenum, GLenum, GLuint)
|
||||
GL_ENTRY(void, glFramebufferTexture2DOES, GLenum, GLenum, GLenum, GLuint, GLint)
|
||||
GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum, GLenum, GLenum, GLint*)
|
||||
GL_ENTRY(void, glGenerateMipmapOES, GLenum)
|
||||
GL_ENTRY(void*, glMapBufferOES, GLenum, GLenum)
|
||||
GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum)
|
||||
GL_ENTRY(void, glGetBufferPointervOES, GLenum, GLenum, void**)
|
||||
GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint)
|
||||
GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void)
|
||||
GL_ENTRY(void, glMatrixIndexPointerOES, GLint, GLenum, GLsizei, const GLvoid *)
|
||||
GL_ENTRY(void, glWeightPointerOES, GLint, GLenum, GLsizei, const GLvoid *)
|
||||
GL_ENTRY(void, glTexGenfOES, GLenum, GLenum, GLfloat)
|
||||
GL_ENTRY(void, glTexGenfvOES, GLenum, GLenum, const GLfloat *)
|
||||
GL_ENTRY(void, glTexGeniOES, GLenum, GLenum, GLint)
|
||||
GL_ENTRY(void, glTexGenivOES, GLenum, GLenum, const GLint *)
|
||||
GL_ENTRY(void, glTexGenxOES, GLenum, GLenum, GLfixed)
|
||||
GL_ENTRY(void, glTexGenxvOES, GLenum, GLenum, const GLfixed *)
|
||||
GL_ENTRY(void, glGetTexGenfvOES, GLenum, GLenum, GLfloat *)
|
||||
GL_ENTRY(void, glGetTexGenivOES, GLenum, GLenum, GLint *)
|
||||
GL_ENTRY(void, glGetTexGenxvOES, GLenum, GLenum, GLfixed *)
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#define GL_LOGGER 0
|
||||
#if !defined(__arm__)
|
||||
#define USE_SLOW_BINDING 1
|
||||
#else
|
||||
@@ -35,7 +36,7 @@
|
||||
#define MAX_NUMBER_OF_GL_EXTENSIONS 32
|
||||
|
||||
|
||||
#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && !GL_LOGGER && __OPTIMIZE__
|
||||
#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && __OPTIMIZE__
|
||||
#define USE_FAST_TLS_KEY 1
|
||||
#else
|
||||
#define USE_FAST_TLS_KEY 0
|
||||
@@ -55,7 +56,10 @@ const unsigned int NUM_DISPLAYS = 1;
|
||||
enum {
|
||||
IMPL_HARDWARE = 0,
|
||||
IMPL_SOFTWARE,
|
||||
IMPL_CONTEXT_LOST,
|
||||
|
||||
IMPL_NUM_DRIVERS_IMPLEMENTATIONS,
|
||||
|
||||
IMPL_CONTEXT_LOST = IMPL_NUM_DRIVERS_IMPLEMENTATIONS,
|
||||
IMPL_NO_CONTEXT,
|
||||
|
||||
IMPL_NUM_IMPLEMENTATIONS
|
||||
|
||||
65
opengl/libs/tools/glapigen
Executable file
65
opengl/libs/tools/glapigen
Executable file
@@ -0,0 +1,65 @@
|
||||
#! /usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2008 Google Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
use strict;
|
||||
|
||||
my $lineNum = 0;
|
||||
while (my $line = <>) {
|
||||
$lineNum += 1;
|
||||
next if $line =~ /^\//;
|
||||
next if $line =~ /^#/;
|
||||
next if $line =~ /^\s*$/;
|
||||
if ($line !~ /^GL_ENTRY\(([^,]+),\s*([^,]+),\s*([^)]+)\)/) {
|
||||
printf STDERR "Cannot parse line number $lineNum:\n$line";
|
||||
next;
|
||||
}
|
||||
my $type = $1;
|
||||
my $name = $2;
|
||||
my $args = $3;
|
||||
|
||||
printf("%s API_ENTRY(%s)(", $type, $name);
|
||||
my @args = split ',', $args;
|
||||
|
||||
my $len = scalar(@args);
|
||||
for (my $num = 0; $num < $len; $num++) {
|
||||
print ", " if $num > 0;
|
||||
my $arg = $args[$num];
|
||||
if ($arg =~ /([^]]+)(\[[^]]\])/) {
|
||||
my $argtype = $1;
|
||||
my $array = $2;
|
||||
printf("%s arg%d%s", $argtype, $num, $array);
|
||||
} else {
|
||||
if ($arg eq "void") {
|
||||
printf("void");
|
||||
} else {
|
||||
printf("%s arg%d", $arg, $num);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(") {\n");
|
||||
if ($type eq "void") {
|
||||
printf(" CALL_GL_API(%s", $name);
|
||||
} else {
|
||||
printf(" CALL_GL_API_RETURN(%s", $name);
|
||||
}
|
||||
for (my $num = 0; $num < $len; $num++) {
|
||||
if ($args[$num] ne "void") {
|
||||
print ", ";
|
||||
printf("arg%d", $num);
|
||||
}
|
||||
}
|
||||
printf(");\n}\n\n");
|
||||
}
|
||||
Reference in New Issue
Block a user