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

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 4 14:06:41 UTC 2012


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

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Oct  2 09:51:12 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.

---

 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 019516f..2250815 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2871,13 +2871,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