diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-24 13:09:06 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-24 13:09:06 -0700 |
commit | affb4e7694a4184d257d0ac71e3119e015b558e2 (patch) | |
tree | 058bdb636f12046858a80071f6d3aae71db75e01 | |
parent | 8cac9064f5e4863f62d59560cbe9a54a61ba4a9a (diff) | |
parent | 04ae634a5ab8398c5d10dcac94da25101a141300 (diff) | |
download | frameworks_base-affb4e7694a4184d257d0ac71e3119e015b558e2.zip frameworks_base-affb4e7694a4184d257d0ac71e3119e015b558e2.tar.gz frameworks_base-affb4e7694a4184d257d0ac71e3119e015b558e2.tar.bz2 |
Merge change 534 into donut
* changes:
Make sure to map undefined OES functions to their non-OES counterpart if it exists.
-rw-r--r-- | opengl/libs/EGL/egl.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index 6fc0fed..ff005e2 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -273,6 +273,8 @@ int gpu_release(void*, request_gpu_t* gpu); static __attribute__((noinline)) void *load_driver(const char* driver, gl_hooks_t* hooks) { + //LOGD("%s", driver); + char scrap[256]; void* dso = dlopen(driver, RTLD_NOW | RTLD_LOCAL); LOGE_IF(!dso, "couldn't load <%s> library (%s)", @@ -310,7 +312,7 @@ void *load_driver(const char* driver, gl_hooks_t* hooks) *curr++ = f; api++; } - + gl_hooks_t::gl_t* gl = &hooks->gl; curr = (__eglMustCastToProperFunctionPointerType*)gl; api = gl_names; @@ -321,10 +323,32 @@ void *load_driver(const char* driver, gl_hooks_t* hooks) if (f == NULL) { // couldn't find the entry-point, use eglGetProcAddress() f = getProcAddress(name); - if (f == NULL) { - f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; + } + if (f == NULL) { + // Try without the OES postfix + ssize_t index = ssize_t(strlen(name)) - 3; + if ((index>0 && (index<255)) && (!strcmp(name+index, "OES"))) { + strncpy(scrap, name, index); + scrap[index] = 0; + f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap); + //LOGD_IF(f, "found <%s> instead", scrap); } } + if (f == NULL) { + // Try with the OES postfix + ssize_t index = ssize_t(strlen(name)) - 3; + if ((index>0 && (index<252)) && (strcmp(name+index, "OES"))) { + strncpy(scrap, name, index); + scrap[index] = 0; + strcat(scrap, "OES"); + f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap); + //LOGD_IF(f, "found <%s> instead", scrap); + } + } + if (f == NULL) { + LOGD("%s", name); + f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; + } *curr++ = f; api++; } |