[Mesa-dev] [PATCH 1/4] mesa: add MAX_PIXEL_BYTES define

Jose Fonseca jfonseca at vmware.com
Tue Dec 6 01:12:05 PST 2011


And the rest of the series looks good to me too.

Jose

----- Original Message -----
> I suppose that 16 is enough because Mesa always uses floats as
> intermediates (and never doubles), right?
> 
> Either way is a good cleanup.
> 
> Jose
> 
> ----- Original Message -----
> > In a few places we need to allocate space for some number of
> > generic
> > pixels.  Use this new define instead of a magic number like 16 or
> > 4 * sizeof(GLuint).
> > ---
> >  src/mesa/main/formats.c |    2 ++
> >  src/mesa/main/formats.h |    8 ++++++++
> >  2 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> > index 595da77..1f83a53 100644
> > --- a/src/mesa/main/formats.c
> > +++ b/src/mesa/main/formats.c
> > @@ -1553,6 +1553,8 @@ _mesa_get_format_bytes(gl_format format)
> >  {
> >     const struct gl_format_info *info =
> >     _mesa_get_format_info(format);
> >     ASSERT(info->BytesPerBlock);
> > +   ASSERT(info->BytesPerBlock <= MAX_PIXEL_BYTES ||
> > +          _mesa_is_format_compressed(format));
> >     return info->BytesPerBlock;
> >  }
> >  
> > diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> > index 3960f02..e6b429d 100644
> > --- a/src/mesa/main/formats.h
> > +++ b/src/mesa/main/formats.h
> > @@ -47,6 +47,14 @@ extern "C" {
> >  
> >  
> >  /**
> > + * Max number of bytes for any non-compressed pixel format below,
> > or
> > for
> > + * intermediate pixel storage in Mesa.  This should never be less
> > than
> > + * 16.  Maybe 32 someday?
> > + */
> > +#define MAX_PIXEL_BYTES 16
> > +
> > +
> > +/**
> >   * Mesa texture/renderbuffer image formats.
> >   */
> >  typedef enum
> > --
> > 1.7.3.4
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list