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

Eric Anholt eric at anholt.net
Thu Oct 20 10:56:59 PDT 2011


On Tue, 18 Oct 2011 16:56:48 -0600, Brian Paul <brianp at vmware.com> wrote:
> On 10/18/2011 04:09 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).
> >
> > v2: Do the early return before calling into the driver function.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40308
> > ---
> >   src/mesa/main/fbobject.c |    8 ++++++++
> >   1 files changed, 8 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> > index f9da54e..c56062a 100644
> > --- a/src/mesa/main/fbobject.c
> > +++ b/src/mesa/main/fbobject.c
> > @@ -2486,6 +2486,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
> >   void GLAPIENTRY
> >   _mesa_GenerateMipmapEXT(GLenum target)
> >   {
> > +   struct gl_texture_image *srcImage;
> >      struct gl_texture_object *texObj;
> >      GLboolean error;
> >
> > @@ -2532,6 +2533,13 @@ _mesa_GenerateMipmapEXT(GLenum target)
> >      }
> >
> >      _mesa_lock_texture(ctx, texObj);
> > +
> > +   srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel);
> > +   if (!srcImage) {
> > +      _mesa_unlock_texture(ctx, texObj);
> > +      return;
> > +   }
> > +
> >      if (target == GL_TEXTURE_CUBE_MAP) {
> >         GLuint face;
> >         for (face = 0; face<  6; face++)
> 
> Reviewed-by: Brian Paul <brianp at vmware.com>
> 
> BTW, for anyone else reading along, the earlier _mesa_cube_complete() 
> test (if it passes) will ensure that checking just the positive-X face 
> image is sufficient for cubemaps.

Argh.  Somehow I squashed this patch into the pixelstoref patch.  (I'll
use as my excuse the fact that gnome-shell has redraw bugs for me right
now, so what I see on my screen doesn't necessarily reflect what is on
my screen.  More careful reading before pushing should still have caught
it, though).

Luckily, both are 7.11 quality, so I think I'll just let it slide.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111020/c72eb476/attachment.pgp>


More information about the mesa-dev mailing list