[Mesa-dev] [PATCH 09/15] mesa: Add utility function mesa_is_enum_format_snorm()

Jason Ekstrand jason at jlekstrand.net
Tue Jul 29 17:02:16 PDT 2014


You should fix the commit message to be _mesa_is_enum_format_snorm (you
forgot the beginning underscore).  Other than that, looks good.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:

> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/main/glformats.c | 37 +++++++++++++++++++++++++++++++++++++
>  src/mesa/main/glformats.h |  3 +++
>  2 files changed, 40 insertions(+)
>
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 9bb341c..05a3842 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -355,6 +355,43 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum
> type)
>     }
>  }
>
> +/**
> + * Test if the given format is a SNORM (signed-normalized) format.
> + */
> +GLboolean
> +_mesa_is_enum_format_snorm(GLenum format)
> +{
> +   switch (format) {
> +   /* signed, normalized texture formats */
> +   case GL_RED_SNORM:
> +   case GL_R8_SNORM:
> +   case GL_R16_SNORM:
> +   case GL_RG_SNORM:
> +   case GL_RG8_SNORM:
> +   case GL_RG16_SNORM:
> +   case GL_RGB_SNORM:
> +   case GL_RGB8_SNORM:
> +   case GL_RGB16_SNORM:
> +   case GL_RGBA_SNORM:
> +   case GL_RGBA8_SNORM:
> +   case GL_RGBA16_SNORM:
> +   case GL_ALPHA_SNORM:
> +   case GL_ALPHA8_SNORM:
> +   case GL_ALPHA16_SNORM:
> +   case GL_LUMINANCE_SNORM:
> +   case GL_LUMINANCE8_SNORM:
> +   case GL_LUMINANCE16_SNORM:
> +   case GL_LUMINANCE_ALPHA_SNORM:
> +   case GL_LUMINANCE8_ALPHA8_SNORM:
> +   case GL_LUMINANCE16_ALPHA16_SNORM:
> +   case GL_INTENSITY_SNORM:
> +   case GL_INTENSITY8_SNORM:
> +   case GL_INTENSITY16_SNORM:
> +      return GL_TRUE;
> +   default:
> +      return GL_FALSE;
> +   }
> +}
>
>  /**
>   * Test if the given format is an integer (non-normalized) format.
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index 5c3b2e3..d4856e5 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -60,6 +60,9 @@ extern GLboolean
>  _mesa_is_type_unsigned(GLenum type);
>
>  extern GLboolean
> +_mesa_is_enum_format_snorm(GLenum format);
> +
> +extern GLboolean
>  _mesa_is_enum_format_integer(GLenum format);
>
>  extern GLboolean
> --
> 1.8.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140729/c49b340d/attachment.html>


More information about the mesa-dev mailing list