[Mesa-dev] [PATCH 01/13] mesa: Add new MESA_FORMATs for ETC2 compressed textures

Brian Paul brianp at vmware.com
Tue Nov 13 07:34:23 PST 2012


On 11/12/2012 08:48 PM, Anuj Phogat wrote:
> It is required by OpenGL ES 3.0 to support ETC2 textures.
> This patch adds new MESA_FORMATs for following etc2 texture
> formats:
>   GL_COMPRESSED_RGB8_ETC2
>   GL_COMPRESSED_SRGB8_ETC2
>   GL_COMPRESSED_RGBA8_ETC2_EAC
>   GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
>   GL_COMPRESSED_R11_EAC
>   GL_COMPRESSED_RG11_EAC
>   GL_COMPRESSED_SIGNED_R11_EAC
>   GL_COMPRESSED_SIGNED_RG11_EAC
>   MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1
>   MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1
>
> Above formats are currently available in only gles 3.0.
>
> v2: Add entries in texfetch_funcs[] array.
>
> Signed-off-by: Anuj Phogat<anuj.phogat at gmail.com>
> ---
>   src/mesa/main/format_unpack.c |   75 +++++++++++++++++++++++-
>   src/mesa/main/formats.c       |  133 +++++++++++++++++++++++++++++++++++++++++
>   src/mesa/main/formats.h       |   10 +++
>   src/mesa/main/glformats.c     |   21 +++++++
>   src/mesa/main/texcompress.c   |  100 +++++++++++++++++++++++++++++++
>   src/mesa/main/texformat.c     |   37 +++++++++++
>   src/mesa/main/teximage.c      |   21 +++++++
>   src/mesa/main/texstore.c      |   12 ++++
>   src/mesa/swrast/s_texfetch.c  |   60 ++++++++++++++++++
>   9 files changed, 468 insertions(+), 1 deletions(-)
>

[...]

> diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
> index f0bc7fd..96f553d 100644
> --- a/src/mesa/main/texformat.c
> +++ b/src/mesa/main/texformat.c
> @@ -972,6 +972,43 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
>         }
>      }
>
> +   if (_mesa_is_gles3(ctx)) {
> +      switch (internalFormat) {
> +         case GL_COMPRESSED_RGB8_ETC2:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RGB8);
> +            break;
> +         case GL_COMPRESSED_SRGB8_ETC2:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SRGB8);
> +            break;
> +         case GL_COMPRESSED_RGBA8_ETC2_EAC:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RGBA8_EAC);
> +            break;
> +         case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC);
> +            break;
> +         case GL_COMPRESSED_R11_EAC:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_R11_EAC);
> +            break;
> +         case GL_COMPRESSED_RG11_EAC:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RG11_EAC);
> +            break;
> +         case GL_COMPRESSED_SIGNED_R11_EAC:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SIGNED_R11_EAC);
> +            break;
> +         case GL_COMPRESSED_SIGNED_RG11_EAC:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SIGNED_RG11_EAC);
> +            break;
> +         case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1);
> +            break;
> +         case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
> +            RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1);
> +            break;
> +         default:
> +            ; /* fallthrough */
> +      }

Those switch cases are indented differently than others in the file.

Also, the nonlinear_to_linear() function should probably have the 
_mesa_ prefix since it's no longer a static function.


Otherwise, the series looks OK to me.

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list