Signed-off-by: Kristian Høgsberg <[email protected]>
---
src/mesa/main/dd.h | 11 +++++++++++
src/mesa/main/fbobject.c | 24 ++++++++++++++++++++++++
src/mesa/main/fbobject.h | 3 +++
src/mesa/main/mfeatures.h | 2 ++
src/mesa/main/teximage.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/mesa/main/teximage.h | 2 ++
6 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index d98a14e..079e44b 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1035,6 +1035,17 @@ struct dd_function_table {
GLfloat width, GLfloat height);
/*...@}*/
#endif
+
+#if FEATURE_OES_EGL_image
+ void (*EGLImageTargetTexture2D)(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ GLeglImageOES image_handle);
+ void (*EGLImageTargetRenderbufferStorage)(GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ void *image_handle);
+#endif
+
};
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 0e6f69f..475aeab 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1008,6 +1008,30 @@ renderbuffer_storage(GLenum target, GLenum
internalFormat,
*/
}
+#if FEATURE_OES_EGL_image
+void GLAPIENTRY
+_mesa_EGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ struct gl_renderbuffer *rb;
+
+ if (target != GL_RENDERBUFFER_EXT) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
"EGLImageTargetRenderbufferStorageOES");
+ return;
+ }
+
+ rb = ctx->CurrentRenderbuffer;
+ if (!rb) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
"EGLImageTargetRenderbufferStorageOES");
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
+ ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image);
+}
+#endif
/**
* Helper function for _mesa_GetRenderbufferParameterivEXT() and
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 5409394..28f75df 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -89,6 +89,9 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei
samples,
GLsizei width, GLsizei height);
extern void GLAPIENTRY
+_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
+
+extern void GLAPIENTRY
_mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname,
GLint *params);
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
index 4e68bc1..f0896ee 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -122,5 +122,7 @@
#define FEATURE_NV_fragment_program _HAVE_FULL_GL
#define FEATURE_NV_vertex_program _HAVE_FULL_GL
+#define FEATURE_OES_EGL_image _HAVE_FULL_GL
+
#endif /* FEATURES_H */
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index da3c6f9..6b15c40 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2448,6 +2448,47 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum
internalFormat,
}
+#if FEATURE_OES_EGL_image
+void GLAPIENTRY
+_mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+
+ if (target != GL_TEXTURE_2D) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)");
+ return;
+ }
+
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
+ _mesa_update_state(ctx);
+
+ texObj = _mesa_get_current_tex_object(ctx, target);
+ _mesa_lock_texture(ctx, texObj);
+
+ texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
+ if (!texImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ } else {
+ if (texImage->Data)
+ ctx->Driver.FreeTexImageData( ctx, texImage );
+
+ ASSERT(texImage->Data == NULL);
+ //clear_teximage_fields(texImage); /* not really needed, but helpful */
+ ctx->Driver.EGLImageTargetTexture2D(ctx, target,
+ texObj, texImage, image);
+
+ /* state update */
+ texObj->_Complete = GL_FALSE;
+ ctx->NewState |= _NEW_TEXTURE;
+ }
+ _mesa_unlock_texture(ctx, texObj);
+
+}
+#endif
+
void GLAPIENTRY
_mesa_TexSubImage1D( GLenum target, GLint level,
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 97c9018..d82cc98 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -165,6 +165,8 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum
internalformat,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels );
+extern void GLAPIENTRY
+_mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
extern void GLAPIENTRY
_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
--
1.6.5.rc2
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev