[Mesa-dev] [PATCH 1/5] mesa: add helper _mesa_is_format_etc2

Ian Romanick idr at freedesktop.org
Mon Aug 4 14:51:12 PDT 2014


On 08/03/2014 05:40 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/mesa/main/formats.c | 25 +++++++++++++++++++++++++
>  src/mesa/main/formats.h |  3 +++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> index 1f20a9a..b830dbc 100644
> --- a/src/mesa/main/formats.c
> +++ b/src/mesa/main/formats.c
> @@ -2068,6 +2068,31 @@ _mesa_get_format_color_encoding(mesa_format format)
>  
>  
>  /**
> + * Return TRUE if format is an ETC2 compressed format specified
> + * by GL_ARB_ES3_compatibility.
> + */
> +GLboolean

Just the usual comment that we're trying to use bool, true, and false
for non-application facing code.  With that minor nit fixed, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> +_mesa_is_format_etc2(mesa_format format)
> +{
> +   switch (format) {
> +   case MESA_FORMAT_ETC2_RGB8:
> +   case MESA_FORMAT_ETC2_SRGB8:
> +   case MESA_FORMAT_ETC2_RGBA8_EAC:
> +   case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
> +   case MESA_FORMAT_ETC2_R11_EAC:
> +   case MESA_FORMAT_ETC2_RG11_EAC:
> +   case MESA_FORMAT_ETC2_SIGNED_R11_EAC:
> +   case MESA_FORMAT_ETC2_SIGNED_RG11_EAC:
> +   case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1:
> +   case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
> +      return GL_TRUE;
> +   default:
> +      return GL_FALSE;
> +   }
> +}
> +
> +
> +/**
>   * For an sRGB format, return the corresponding linear color space format.
>   * For non-sRGB formats, return the format as-is.
>   */
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index dc50bc8..166cd22 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -446,6 +446,9 @@ _mesa_is_format_signed(mesa_format format);
>  extern GLboolean
>  _mesa_is_format_integer(mesa_format format);
>  
> +extern GLboolean
> +_mesa_is_format_etc2(mesa_format format);
> +
>  extern GLenum
>  _mesa_get_format_color_encoding(mesa_format format);
>  
> 



More information about the mesa-dev mailing list