[Mesa-dev] [PATCH 1/2] mesa: don't call TexImage driver hooks for zero-sized images

Brian Paul brianp at vmware.com
Tue Oct 2 08:59:27 PDT 2012


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 afda0ea..c27ccb9 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2881,13 +2881,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);
-- 
1.7.3.4



More information about the mesa-dev mailing list