On Mon, 2010-05-03 at 10:25 -0700, 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. > > 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; > }
Just return desc->short_name. It's lower case so it's easier to read. Also please modify src/gallium/drivers/trace/tr_dump_state.c to use the full caps name, as retrace relies on it. > 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; > +} > + This is fine. I have no problem with adding more such functions here, but for the record, a better practice would be to call util_format_description once and then do necessary operations with it. And typically there are several. That is I'd rather see all inline functions in u_format.h taking as argument the struct util_format_description *desc, expect util_format_description(). > static INLINE boolean > util_format_is_s3tc(enum pipe_format format) > { > > May I push them? Jose _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev