Mesa (master): mesa: new comments, assertion related to glClearTexSubImage

Brian Paul brianp at kemper.freedesktop.org
Thu Jul 6 22:41:53 UTC 2017


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jul  5 14:44:08 2017 -0600

mesa: new comments, assertion related to glClearTexSubImage

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/mesa/main/teximage.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 36747a7273..7b5df54ca1 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4361,6 +4361,15 @@ get_tex_obj_for_clear(struct gl_context *ctx,
    return texObj;
 }
 
+
+/**
+ * For clearing cube textures, the zoffset and depth parameters indicate
+ * which cube map faces are to be cleared.  This is the one case where we
+ * need to be concerned with multiple gl_texture_images.  This function
+ * returns the array of texture images to clear for cube maps, or one
+ * texture image otherwise.
+ * \return number of texture images, 0 for error, 6 for cube, 1 otherwise.
+ */
 static int
 get_tex_images_for_clear(struct gl_context *ctx,
                          const char *function,
@@ -4430,6 +4439,7 @@ _mesa_ClearTexSubImage( GLuint texture, GLint level,
       minDepth = -(int) texImages[0]->Border;
       maxDepth = texImages[0]->Depth;
    } else {
+      assert(numImages == MAX_FACES);
       minDepth = 0;
       maxDepth = numImages;
    }
@@ -4459,7 +4469,9 @@ _mesa_ClearTexSubImage( GLuint texture, GLint level,
                                       data ? clearValue[0] : NULL);
       }
    } else {
+      /* loop over cube face images */
       for (i = zoffset; i < zoffset + depth; i++) {
+         assert(i < MAX_FACES);
          if (!check_clear_tex_image(ctx, "glClearTexSubImage",
                                     texImages[i],
                                     format, type, data, clearValue[i]))




More information about the mesa-commit mailing list