Skip to content

libtxc_dxtn

Rudolf Polzer edited this page Jul 19, 2011 · 1 revision

S2TC - libtxc_dxtn

We provide a libtxc_dxtn replacement that uses S2TC to compress and decompress textures, which can be directly used by Mesa/DRI.

Compression

How this library compresses textures, can be configured by the EnvironmentVariables. By default, it is set to be a bit faster than the S3TC libtxc_dxtn.

Decompression

Decompressing S2TC textures will work perfectly. However, it can not decompress S3TC input correctly. What will happen if you try doing so anyway, can be seen on this screenshot:

S3TC decompressed by S2TC

Basically, any pixels S2TC can not decompress (which are "reserved" in the FileFormats specification), will at 50 percent chance (in an ordered dither) pick one of the two per-block candidate colors. This is clearly a quality reduction compared to a real S3TC decoder, but still is usually acceptable.

Note though that S2TC decompression typically is NOT used when using libtxc_dxtn by Mesa/DRI. The only cases when this is used, are software fallback (that is usually very slow anyway, and does not happen on modern chipsets at all), and of course when using the llvmpipe driver (which is how I made this screenshot).

Testing the library

You can test the library without installing it by compiling it using

./configure
make

and then not using make install, but instead calling a program with LD_LIBRARY_PATH set to the .libs subdirectory of the S2TC distribution:

LD_LIBRARY_PATH=/home/rpolzer/s2tc/.libs ./darkplaces-sdl
Clone this wiki locally