[Mesa-dev] [PATCH] st/mesa: add missing ETC2 entries to format_map

Ilia Mirkin imirkin at alum.mit.edu
Tue Feb 16 17:14:27 UTC 2016


Should be noted that, not at all due to this patch,
glTexStorage(ETC1/ETC2) is broken on gallium drivers that don't
implement those formats in HW (i.e. use the sw fallback). This patch
makes it work for drivers that *do* support it in HW, but more work
needed for the other drivers. Maybe we should just have the
PIPE_FORMAT_RGBA8 stuff right in there as fallback formats? [Would
need to do that for ETC1 as well.]

On Tue, Feb 16, 2016 at 12:04 PM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> Noticed by Ilia when I was trying to figure out why some app was failing
> to use ETC2.
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/mesa/state_tracker/st_format.c | 42 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
> index 2b92bad..82bf3a1 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -1484,6 +1484,48 @@ static const struct format_mapping format_map[] = {
>        { PIPE_FORMAT_ETC1_RGB8, 0 }
>     },
>
> +   /* ETC2 */
> +   {
> +      { GL_COMPRESSED_RGB8_ETC2, 0 },
> +      { PIPE_FORMAT_ETC2_RGB8, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_SRGB8_ETC2, 0 },
> +      { PIPE_FORMAT_ETC2_SRGB8, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 0 },
> +      { PIPE_FORMAT_ETC2_RGB8A1, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 0 },
> +      { PIPE_FORMAT_ETC2_SRGB8A1, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_RGBA8_ETC2_EAC, 0 },
> +      { PIPE_FORMAT_ETC2_RGBA8, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 0 },
> +      { PIPE_FORMAT_ETC2_SRGBA8, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_R11_EAC, 0 },
> +      { PIPE_FORMAT_ETC2_R11_UNORM, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_SIGNED_R11_EAC, 0 },
> +      { PIPE_FORMAT_ETC2_R11_SNORM, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_RG11_EAC, 0 },
> +      { PIPE_FORMAT_ETC2_RG11_UNORM, 0 }
> +   },
> +   {
> +      { GL_COMPRESSED_SIGNED_RG11_EAC, 0 },
> +      { PIPE_FORMAT_ETC2_RG11_SNORM, 0 }
> +   },
> +
>     /* BPTC */
>     {
>        { GL_COMPRESSED_RGBA_BPTC_UNORM, 0 },
> --
> 2.5.0
>


More information about the mesa-dev mailing list