On 10/17/2011 02:45 PM, Eric Anholt wrote:
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 */

I think this check should come sooner. We typically do error checking and no-op checking before calling the ctx->Driver.Foobar() functions.

The above fix might work for the fallback path, but what about if ctx->Driver.GenerateMipmap points to _mesa_meta_GenerateMipmap() or st_generate_mipmap()?

I think I'd try to do the check in _mesa_GenerateMipmapEXT().

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to