Mesa (master): st/mesa: Convert size assertions to conditionals in st_texture_image_copy.

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Sep 22 15:02:11 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Sep 22 17:01:18 2011 +0200

st/mesa: Convert size assertions to conditionals in st_texture_image_copy.

Prevents potential assertion failures in piglit fbo-incomplete-texture-03 test.

NOTE: This is a candidate for the 7.11 branch.

---

 src/mesa/state_tracker/st_texture.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index c5dc7dc..bf98e76 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -366,9 +366,15 @@ st_texture_image_copy(struct pipe_context *pipe,
    struct pipe_box src_box;
    GLuint i;
 
-   assert(u_minify(src->width0, srcLevel) == width);
-   assert(u_minify(src->height0, srcLevel) == height);
-   assert(u_minify(src->depth0, srcLevel) == depth);
+   if (u_minify(src->width0, srcLevel) != width ||
+       u_minify(src->height0, srcLevel) != height ||
+       u_minify(src->depth0, srcLevel) != depth) {
+      /* The source image size doesn't match the destination image size.
+       * This can happen in some degenerate situations such as rendering to a
+       * cube map face which was set up with mismatched texture sizes.
+       */
+      return;
+   }
 
    src_box.x = 0;
    src_box.y = 0;




More information about the mesa-commit mailing list