[Mesa-stable] [PATCH V2] mesa: Add utility function _mesa_is_enum_format_unorm()
Jason Ekstrand
jason at jlekstrand.net
Thu Jul 31 16:41:46 PDT 2014
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
On Thu, Jul 31, 2014 at 1:49 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> V2: Add missing formats.
>
> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
> src/mesa/main/glformats.c | 71
> +++++++++++++++++++++++++++++++++++++++++++++++
> src/mesa/main/glformats.h | 3 ++
> 2 files changed, 74 insertions(+)
>
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 77eee4f..0fb25ba 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -410,6 +410,77 @@ _mesa_is_enum_format_unsized(GLenum format)
> }
>
> /**
> + * Test if the given format is a UNORM (unsigned-normalized) format.
> + */
> +GLboolean
> +_mesa_is_enum_format_unorm(GLenum format)
> +{
> + switch(format) {
> + case GL_RED:
> + case GL_GREEN:
> + case GL_BLUE:
> + case GL_ALPHA:
> + case GL_ALPHA4:
> + case GL_ALPHA8:
> + case GL_ALPHA12:
> + case GL_ALPHA16:
> + case 1:
> + case GL_LUMINANCE:
> + case GL_SLUMINANCE:
> + case GL_LUMINANCE4:
> + case GL_LUMINANCE8:
> + case GL_LUMINANCE12:
> + case GL_LUMINANCE16:
> + case 2:
> + case GL_LUMINANCE_ALPHA:
> + case GL_SLUMINANCE_ALPHA:
> + case GL_LUMINANCE4_ALPHA4:
> + case GL_LUMINANCE6_ALPHA2:
> + case GL_LUMINANCE8_ALPHA8:
> + case GL_LUMINANCE12_ALPHA4:
> + case GL_LUMINANCE12_ALPHA12:
> + case GL_LUMINANCE16_ALPHA16:
> + case GL_INTENSITY:
> + case GL_INTENSITY4:
> + case GL_INTENSITY8:
> + case GL_INTENSITY12:
> + case GL_INTENSITY16:
> + case GL_R8:
> + case GL_R16:
> + case GL_RG:
> + case GL_RG8:
> + case GL_RG16:
> + case 3:
> + case GL_RGB:
> + case GL_BGR:
> + case GL_SRGB:
> + case GL_R3_G3_B2:
> + case GL_RGB4:
> + case GL_RGB5:
> + case GL_RGB565:
> + case GL_RGB8:
> + case GL_RGB10:
> + case GL_RGB12:
> + case GL_RGB16:
> + case 4:
> + case GL_ABGR_EXT:
> + case GL_RGBA:
> + case GL_BGRA:
> + case GL_SRGB_ALPHA:
> + case GL_RGBA2:
> + case GL_RGBA4:
> + case GL_RGB5_A1:
> + case GL_RGBA8:
> + case GL_RGB10_A2:
> + case GL_RGBA12:
> + case GL_RGBA16:
> + return GL_TRUE;
> + default:
> + return GL_FALSE;
> + }
> +}
> +
> +/**
> * Test if the given format is a SNORM (signed-normalized) format.
> */
> GLboolean
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index 6c553ae..7b03215 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -60,6 +60,9 @@ extern GLboolean
> _mesa_is_enum_format_unsized(GLenum format);
>
> extern GLboolean
> +_mesa_is_enum_format_unorm(GLenum format);
> +
> +extern GLboolean
> _mesa_is_enum_format_snorm(GLenum format);
>
> extern GLboolean
> --
> 1.9.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-stable/attachments/20140731/75be6c82/attachment.html>
More information about the mesa-stable
mailing list