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

Neil Roberts neil at linux.intel.com
Tue Jul 22 12:09:55 PDT 2014


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.

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.

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



More information about the mesa-dev mailing list