mesa: don't call TexImage driver hooks for zero-sized images
authorBrian Paul <brianp@vmware.com>
Tue, 2 Oct 2012 15:51:12 +0000 (09:51 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 4 Oct 2012 13:59:11 +0000 (07:59 -0600)
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

index 019516f00a413d83bcc0f1b2fc64e0f75dc6d411..2250815783facc6034abae190d71fa96fff211c3 100644 (file)
@@ -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);