[Mesa-dev] [PATCH 20/22] mesa: Add decoding functions for GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2

Brian Paul brianp at vmware.com
Mon Nov 12 08:00:05 PST 2012


On 11/10/2012 12:30 AM, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat<anuj.phogat at gmail.com>
> ---
>   src/mesa/main/texcompress_etc.c |   77 +++++++++++++++++++++++++++++++++++++++
>   src/mesa/main/texcompress_etc.h |    8 ++++
>   2 files changed, 85 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
> index c397b4d..ff7d505 100644
> --- a/src/mesa/main/texcompress_etc.c
> +++ b/src/mesa/main/texcompress_etc.c
> @@ -1066,6 +1066,47 @@ etc2_unpack_rgb8_punchthrough_alpha1(uint8_t *dst_row,
>      }
>   }
>
> +static void
> +etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row,
> +                                     unsigned dst_stride,
> +                                     const uint8_t *src_row,
> +                                     unsigned src_stride,
> +                                     unsigned width,
> +                                     unsigned height)
> +{
> +   const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
> +   struct etc2_block block;
> +   unsigned x, y, i, j;
> +   uint8_t tmp;
> +
> +   for (y = 0; y<  height; y += bh) {
> +      const uint8_t *src = src_row;
> +
> +      for (x = 0; x<  width; x+= bw) {
> +         etc2_rgb8_parse_block(&block, src,
> +                               true /* punchthrough_alpha */);
> +         for (j = 0; j<  bh; j++) {
> +            uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
> +            for (i = 0; i<  bw; i++) {
> +               etc2_rgb8_fetch_texel(&block, i, j, dst,
> +                                     true /* punchthrough_alpha */);
> +               /* Convert to MESA_FORMAT_SARGB8 */
> +	       tmp = dst[0];
> +               dst[0] = dst[2];
> +               dst[2] = tmp;
> +	       dst[3] = dst[3];

Inconsistent indentation.


-Brian


More information about the mesa-dev mailing list