Switch to a more efficient S3TC/DXTn/BCn compressor
Our compressor library, libtxc_dxtn, is something like 18 years old. A lot of advances in texture compression have been made since then, and newer libraries exist that should be faster, offer higher quality, or both.
Some links to newer compressors:
In particular, Rich Geldreich's rgbcx and bc7enc BC1-7 compressors look interesting. They appear to offer some of the highest quality and speed, while also being MIT licensed, and a tiny codebase (originally a "single source file", but they may have grown a bit):
- https://github.com/richgel999/bc7enc_rdo (note that ISPC is not required)
- https://github.com/richgel999/bc7enc (older repo, but useful info in the README)
We could likely import this into Mesa, since it's compatibly licensed, small, and contained.
Why do we care?
In the past, we mainly used the compressor for OpenGL's "online compression" where the application uploads uncompressed textures, and asks the driver to compress it for them. This is almost never done, because it a) is slow, b) means shipping larger data sets in the app, and c) offers differing quality on different drivers. Instead, apps simply ship compressed textures and upload them directly.
However, we have a new use case: ASTC texture compression transcoding. Most desktop GPUs don't support ASTC, but most mobile GPUs do. So most games targeting Android ship ASTC textures. To support ASTC on desktop GPUs, Mesa decodes them in software, then re-encodes them in BC1/BC5. Our implementation of this decompression/compression is not fast.
It would be great to see how much we could speed up ASTC transcode by switching out our compressor.