Mesa (9.0): mesa: don't call TexImage driver hooks for zero-sized images

Brian Paul brianp at kemper.freedesktop.org
Tue Oct 9 13:48:01 UTC 2012


Module: Mesa
Branch: 9.0
Commit: 32faf7ab0de8b88bb15a2cb262a73c411dce9d0d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32faf7ab0de8b88bb15a2cb262a73c411dce9d0d

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Oct  5 16:47:40 2012 -0600

mesa: don't call TexImage driver hooks for zero-sized images

This simply avoids some failed assertions but there's no reason to
call the driver hooks for storing a tex image if its size is zero.

Note: This is a candidate for the stable branches.
(cherry picked from commit 91d84096497ff538f55591f7e6bb0b563726db8d)

---

 src/mesa/main/teximage.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 21646cc..8004876 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3034,13 +3034,15 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
                                           border, internalFormat, texFormat);
 
                /* Give the texture to the driver.  <pixels> may be null. */
-               if (compressed) {
-                  ctx->Driver.CompressedTexImage(ctx, dims, texImage,
-                                                 imageSize, pixels);
-               }
-               else {
-                  ctx->Driver.TexImage(ctx, dims, texImage, format,
-                                       type, pixels, unpack);
+               if (width > 0 && height > 0 && depth > 0) {
+                  if (compressed) {
+                     ctx->Driver.CompressedTexImage(ctx, dims, texImage,
+                                                    imageSize, pixels);
+                  }
+                  else {
+                     ctx->Driver.TexImage(ctx, dims, texImage, format,
+                                          type, pixels, unpack);
+                  }
                }
 
                check_gen_mipmap(ctx, target, texObj, level);




More information about the mesa-commit mailing list