Module: Mesa
Branch: master
Commit: 8d411eb6b36cb1d8c5e8582d9c6cf30f80859027
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d411eb6b36cb1d8c5e8582d9c6cf30f80859027

Author: Juan A. Suarez Romero <jasua...@igalia.com>
Date:   Thu Apr  5 09:00:46 2018 +0000

gettextureimage: verify cube map is complete

According to OpenGL 4.6 spec, section 8.11.4 ("Texture Image Queries"),
relative to errors for GetTexImage, GetTextureImage, and GetnTexImage:

  "An INVALID_OPERATION error is generated by GetTextureImage if the
   effective target is TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and
   the texture object is not cube complete or cube array complete,
   respectively."

This fixes arb_get_texture_sub_image piglit tests.

Signed-off-by: Juan A. Suarez Romero <jasua...@igalia.com>
Reviewed-by: Iago Toral Quiroga <ito...@igalia.com>

---

 src/mesa/main/texgetimage.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index fbdbcd90a7..85d0ffd477 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -982,15 +982,20 @@ dimensions_error_check(struct gl_context *ctx,
                      "%s(zoffset + depth = %d)", caller, zoffset + depth);
          return true;
       }
-      /* check that the range of faces exist */
-      for (i = 0; i < depth; i++) {
-         GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset + i;
-         if (!_mesa_select_tex_image(texObj, face, level)) {
-            /* non-existant face */
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "%s(missing cube face)", caller);
-            return true;
-         }
+      /* According to OpenGL 4.6 spec, section 8.11.4 ("Texture Image 
Queries"):
+       *
+       *   "An INVALID_OPERATION error is generated by GetTextureImage if the
+       *   effective target is TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY ,
+       *   and the texture object is not cube complete or cube array complete,
+       *   respectively."
+       *
+       * This applies also to GetTextureSubImage, GetCompressedTexImage,
+       * GetCompressedTextureImage, and GetnCompressedTexImage.
+       */
+      if (!_mesa_cube_complete(texObj)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "%s(cube incomplete)", caller);
+         return true;
       }
       break;
    default:

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to