Discussion:
[PATCH] mesa: reject immutable textures in glEGLImageTargetTexture2DOES()
nobled
2012-04-29 15:08:06 UTC
Permalink
GL_ARB_texture_storage says:

The commands eglBindTexImage, wglBindTexImageARB, glXBindTexImageEXT or
EGLImageTargetTexture2DOES are not permitted on an immutable-format
texture.
They will generate the following errors:
- EGLImageTargetTexture2DOES: INVALID_OPERATION
- eglBindTexImage: EGL_BAD_MATCH
- wglBindTexImage: ERROR_INVALID_OPERATION
- glXBindTexImageEXT: BadMatch

Fixing the EGL and GLX cases requires extending the DRI interface,
since setTexBuffer2 doesn't return any error information.
---
src/mesa/main/teximage.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 2348646..50095d2 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2692,6 +2692,13 @@ _mesa_EGLImageTargetTexture2DOES (GLenum
target, GLeglImageOES image)
texObj = _mesa_get_current_tex_object(ctx, target);
_mesa_lock_texture(ctx, texObj);

+ if (texObj->Immutable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glEGLImageTargetTexture2D(texture is immutable)");
+ _mesa_unlock_texture(ctx, texObj);
+ return;
+ }
+
texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
if (!texImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glEGLImageTargetTexture2D");
--
1.7.4.1
Brian Paul
2012-04-30 13:47:30 UTC
Permalink
   The commands eglBindTexImage, wglBindTexImageARB, glXBindTexImageEXT or
   EGLImageTargetTexture2DOES are not permitted on an immutable-format
   texture.
     - EGLImageTargetTexture2DOES: INVALID_OPERATION
     - eglBindTexImage: EGL_BAD_MATCH
     - wglBindTexImage: ERROR_INVALID_OPERATION
     - glXBindTexImageEXT: BadMatch
Fixing the EGL and GLX cases requires extending the DRI interface,
since setTexBuffer2 doesn't return any error information.
---
 src/mesa/main/teximage.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 2348646..50095d2 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2692,6 +2692,13 @@ _mesa_EGLImageTargetTexture2DOES (GLenum
target, GLeglImageOES image)
   texObj = _mesa_get_current_tex_object(ctx, target);
   _mesa_lock_texture(ctx, texObj);
+   if (texObj->Immutable) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                 "glEGLImageTargetTexture2D(texture is immutable)");
+      _mesa_unlock_texture(ctx, texObj);
+      return;
+   }
+
   texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
   if (!texImage) {
      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEGLImageTargetTexture2D");
Reviewed-by: Brian Paul <***@vmware.com>

Loading...