[Mesa-dev] [PATCH 4/6] Add texstore functions for BPTC-compressed textures

Ilia Mirkin imirkin at alum.mit.edu
Tue Jul 22 15:37:43 PDT 2014


On Tue, Jul 22, 2014 at 3:09 PM, Neil Roberts <neil at linux.intel.com> wrote:
> This adds compressors for all four of the BPTC compressed-texture formats. For
> the RGB and SRGB normalized BPTC textures it works by first compressing each
> 4x4 block using the existing DXT3 compressor and then converting it to a BPTC
> block. The BPTC block loses one bit of information on the green component of
> the endpoints and one bit from the alpha values.
>
> The compressor for the two half-float formats is written from scratch and
> takes a very simple approach. It always uses mode 3 of the BPTC format and
> picks the two endpoints by dividing the texels into those which have more or
> less than the average luminance of the block and then calculating an average
> color of the texels within each division.
>
> The first approach using DXT3 gives much better results but neither is really
> very good. However it's probably not really sensible to try to use BPTC
> compression at runtime because for example with the Nvidia compression tool it
> can take in the order of an hour to compress a full-screen image. With that in
> mind I don't think it's worth having a proper compressor in Mesa and this
> approach gives reasonable results for a usage that is basically a corner case.
> ---
>  src/mesa/main/texcompress_bptc.c | 533 +++++++++++++++++++++++++++++++++++++++
>  src/mesa/main/texcompress_bptc.h |  10 +
>  src/mesa/main/texstore.c         |  10 +
>  3 files changed, 553 insertions(+)
>
> diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c
> index 0068975..48271793 100644
> --- a/src/mesa/main/texcompress_bptc.c
> +++ b/src/mesa/main/texcompress_bptc.c
> @@ -956,3 +963,529 @@ _mesa_get_bptc_fetch_func(mesa_format format)
[...]
> +_mesa_texstore_bptc_rgb_unsigned_float(TEXSTORE_PARAMS)
> +{
> +   ASSERT(dstFormat == MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT);
> +
> +   return texstore_bptc_rgb_float(ctx, dims, baseInternalFormat,
> +                                  dstFormat, dstRowStride, dstSlices,
> +                                  srcWidth, srcHeight, srcDepth,
> +                                  srcFormat, srcType,
> +                                  srcAddr, srcPacking,
> +                                  false /* unsigned */);
> +}
> +

Pretty minor, but thought I'd report it:

Applying: Add texstore functions for BPTC-compressed textures
/home/ilia/src/mesa/.git/rebase-apply/patch:561: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Also, don't forget to prefix your patches with things like mesa: or
whatever's appropriate.

Cheers,

  -ilia


More information about the mesa-dev mailing list