summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/egl.cpp
diff options
context:
space:
mode:
authorMichael I. Gold <gold@nvidia.com>2011-01-04 01:16:59 -0800
committerMathias Agopian <mathias@google.com>2011-01-16 18:12:04 -0800
commitf4a43837f9577a24983c17a6c1dc128166af5961 (patch)
tree67ca682df4cbe3572649fbed2aa5f14f01d9083a /opengl/libs/EGL/egl.cpp
parent3ece010a4b09c82b5d59ae62dbed4957f665902c (diff)
downloadframeworks_base-f4a43837f9577a24983c17a6c1dc128166af5961.zip
frameworks_base-f4a43837f9577a24983c17a6c1dc128166af5961.tar.gz
frameworks_base-f4a43837f9577a24983c17a6c1dc128166af5961.tar.bz2
egl: fix GetProcAddress for EGLimage extensions
Return wrappers from GetProcAddress for glEGLImageTargetTexture2DOES and glEGLImageTargetRenderbufferStorageOES which unwrap the EGLimage handle before calling through to the implementation. Change-Id: I2f5b180ab3ccdb28a4f510a2bd8c2eee941a84df
Diffstat (limited to 'opengl/libs/EGL/egl.cpp')
-rw-r--r--opengl/libs/EGL/egl.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 0e3de06..ed36171 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -1473,6 +1473,29 @@ EGLint eglGetError(void)
return result;
}
+// Note: Similar implementations of these functions also exist in
+// gl2.cpp and gl.cpp, and are used by applications that call the
+// exported entry points directly.
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+
+static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES_impl = NULL;
+static PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES_impl = NULL;
+
+static void glEGLImageTargetTexture2DOES_wrapper(GLenum target, GLeglImageOES image)
+{
+ GLeglImageOES implImage =
+ (GLeglImageOES)egl_get_image_for_current_context((EGLImageKHR)image);
+ glEGLImageTargetTexture2DOES_impl(target, implImage);
+}
+
+static void glEGLImageTargetRenderbufferStorageOES_wrapper(GLenum target, GLeglImageOES image)
+{
+ GLeglImageOES implImage =
+ (GLeglImageOES)egl_get_image_for_current_context((EGLImageKHR)image);
+ glEGLImageTargetRenderbufferStorageOES_impl(target, implImage);
+}
+
__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
{
// eglGetProcAddress() could be the very first function called
@@ -1533,6 +1556,16 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
}
if (found) {
addr = gExtensionForwarders[slot];
+
+ if (!strcmp(procname, "glEGLImageTargetTexture2DOES")) {
+ glEGLImageTargetTexture2DOES_impl = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)addr;
+ addr = (__eglMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES_wrapper;
+ }
+ if (!strcmp(procname, "glEGLImageTargetRenderbufferStorageOES")) {
+ glEGLImageTargetRenderbufferStorageOES_impl = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)addr;
+ addr = (__eglMustCastToProperFunctionPointerType)glEGLImageTargetRenderbufferStorageOES_wrapper;
+ }
+
gGLExtentionMap.add(name, addr);
gGLExtentionSlot++;
}