On Wed, Jan 7, 2015 at 11:20 PM, Iago Toral Quiroga <ito...@igalia.com> wrote: > From: Jason Ekstrand <jason.ekstr...@intel.com> > > --- > src/mesa/main/formats.c | 19 +++++++++++++++++++ > src/mesa/main/formats.h | 3 +++ > 2 files changed, 22 insertions(+) > > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c > index b10b628..6eb80fb 100644 > --- a/src/mesa/main/formats.c > +++ b/src/mesa/main/formats.c > @@ -472,6 +472,25 @@ _mesa_is_format_integer(mesa_format format) > return (info->DataType == GL_INT || info->DataType == GL_UNSIGNED_INT); > } > > + > +/** > + * Return true if the given format is a color format. > + */ > +GLenum > +_mesa_is_format_color_format(mesa_format format) > +{ > + const struct gl_format_info *info = _mesa_get_format_info(format); > + switch (info->BaseFormat) { > + case GL_DEPTH_COMPONENT: > + case GL_STENCIL_INDEX: > + case GL_DEPTH_STENCIL: > + return false; > + default: > + return true; > + } > +} > + > + > /** > * Return color encoding for given format. > * \return GL_LINEAR or GL_SRGB > diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h > index 6530548..65796c8 100644 > --- a/src/mesa/main/formats.h > +++ b/src/mesa/main/formats.h > @@ -624,6 +624,9 @@ _mesa_is_format_integer(mesa_format format); > extern bool > _mesa_is_format_etc2(mesa_format format); > > +GLenum > +_mesa_is_format_color_format(mesa_format format); > + > extern GLenum > _mesa_get_format_color_encoding(mesa_format format); > > -- > 1.9.1 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
This new function can be used in _mesa_is_format_integer_color() to avoid code duplication. Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev