[Mesa-dev] [PATCH] mesa: Skip mipmap generation if there is no source image.

Eric Anholt eric at anholt.net
Mon Oct 17 13:45:14 PDT 2011


The spec doesn't explicitly mandate this behavior, but it seems like
the only sensible thing to do (as opposed to assertion failing or
segfaulting).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40308
---

Oops, looks like I never sent this one out for review.

 src/mesa/main/mipmap.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index c2f9226..2b6aead 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -2036,7 +2036,9 @@ _mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
 
    ASSERT(texObj);
    srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel);
-   ASSERT(srcImage);
+
+   if (!srcImage)
+      return;
 
    maxLevel = _mesa_max_texture_levels(ctx, texObj->Target) - 1;
    ASSERT(maxLevel >= 0);  /* bad target */
-- 
1.7.7



More information about the mesa-dev mailing list