[Mesa-dev] [PATCH 0/6] Add support for BPTC texture compression

Ian Romanick idr at freedesktop.org
Wed Jul 23 15:16:31 PDT 2014


On 07/22/2014 12:09 PM, Neil Roberts wrote:
> Here's a first attempt at a patch series to implement BPTC texture
> compression in the i965 driver on Gen>=7.
> 
> Getting it to work on the hardware is pretty trivial as it's just a
> case of adding some new Mesa format enums and then plugging them
> together with the right Intel surface type. However GL requires that
> you are able to get the library to compress textures on the fly so we
> need a compressor too. I think for BPTC it doesn't really make much
> sense to actually use this because it takes a very long time to search
> the entire space and compress an image properly. For example the
> NVidia compressor takes in the order of an hour for a full-screen
> image. Instead I've just done the minimal work needed to get something
> that gives vaguely passable results.

Is that NVIDIA's off-line compression tool, or is that the compressor in
the driver?  A brute-force compressor will be very, very slow for BPTC.
 There are other approaches that are much faster without sacrificing
very much quality.

https://software.intel.com/en-us/vcsource/samples/fast-texture-compression

An implementation of this algorithm is available.

https://github.com/Mokosha/FasTC

It seems like we could just link with the compression libraries produced
by that package.  Though, the license ("Permission to incorporate this
software into commercial products may be obtained by contacting the
authors or the Office of Technology Development at the University of
North Carolina at Chapel Hill <otd at unc.edu>.") may be problematic?

Note the FasTC project also supports ASTC, and we will need to support
that format eventually also.

> For the two normalized formats I've just made it first compress each
> block with the existing DXT3 compressor and then convert the block to
> mode 4 of BPTC. This ends up being worse than just using DXT3 directly
> because it will lose a bit from the green component of the endpoints
> and each alpha index will be 3 bits instead of 4, but it looks ok.

This means that we can only enable BPTC when libtxc_dxtn.so is
available... which means patch 5 needs some changes. :(

> For the two half-float formats I've written a custom compressor which
> just has a very simple algorithm and always uses mode 3.
> 
> I've also written software texel fetch functions for all of the
> formats. I guess in theory we don't need these because we should just
> be able to use the hardware to decompress if someone calls
> glGetTexImage. However Mesa has a static assert to require a texel
> fetch function and it seemed like a good way to learn more about the
> format so I wrote the functions anyway. It also means we can enable
> the extension on the software rasterizer.
> 
> I've written a Piglit test for the decompressor with the normalized
> formats. I also tested the half-float decompressor using NVidia's
> sample texture which tries every mode. It would be good to make a
> Piglit test that does this as well.
> 
> - Neil
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list