[Mesa-dev] 2 util_format patches
José Fonseca
jfonseca at vmware.com
Mon May 3 10:53:24 PDT 2010
On Mon, 2010-05-03 at 10:42 -0700, Brian Paul wrote:
> Marek Olšák wrote:
> > José,
> >
> > the first patch removes the PIPE_FORMAT_ prefix in a string returned by
> > util_format_name, it makes debug logs shorter. The second patch adds
> > util_format_is_plain.
>
> I'd prefer to keep the long format names.
>
> I was recently burned by the Gallium docs omitting the prefixes on a
> set of enums which I was grepping for.
>
> With the full names it's easier to grep for format names and to
> copy&paste for debugging.
Fair enough. I really don't have a preference here.
Marek, if you really want to use short names in the drivers you maintain
then I'd suggest using the desc->short_name there (add a new
util_format_short_name()), but lets keep the long names elsewhere.
> util_format_is_plain() is fine, but please put a comment on it to
> describe what "plain" means to the newbie.
Yeah, I'm terrible with names. There's a description of what "plain"
format means in UTIL_FORMAT_LAYOUT_PLAIN's comment.
Jose
>
> >
> > diff --git a/src/gallium/auxiliary/util/u_format.h
> > b/src/gallium/auxiliary/util/u_format.h
> > index fb6ade5..d851c31 100644
> > --- a/src/gallium/auxiliary/util/u_format.h
> > +++ b/src/gallium/auxiliary/util/u_format.h
> > @@ -332,10 +332,10 @@ util_format_name(enum pipe_format format)
> >
> > assert(desc);
> > if (!desc) {
> > - return "PIPE_FORMAT_???";
> > + return "???";
> > }
> >
> > - return desc->name;
> > + return desc->name+12;
> > }
> >
> > static INLINE boolean
> >
> > diff --git a/src/gallium/auxiliary/util/u_format.h
> > b/src/gallium/auxiliary/util/u_format.h
> > index d851c31..350b817 100644
> > --- a/src/gallium/auxiliary/util/u_format.h
> > +++ b/src/gallium/auxiliary/util/u_format.h
> > @@ -338,6 +338,18 @@ util_format_name(enum pipe_format format)
> > return desc->name+12;
> > }
> >
> > +static INLINE boolean
> > +util_format_is_plain(enum pipe_format format)
> > +{
> > + const struct util_format_description *desc =
> > util_format_description(format);
> > +
> > + if (!format) {
> > + return FALSE;
> > + }
> > +
> > + return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ? TRUE : FALSE;
> > +}
> > +
> > static INLINE boolean
> > util_format_is_s3tc(enum pipe_format format)
> > {
> >
> > May I push them?
> >
> > -Marek
> >
>
More information about the mesa-dev
mailing list