PDA

View Full Version : EXT_texture_compression_latc - Compressing



Bruce Wheaton
07-01-2009, 01:33 PM
I can't tell from the spec - if I pass in an 8-bit luminance texture, and request this as the internal format, will the driver compress it for me?

And would it do it quickly, i.e. hardware, or slowly as it transfers?

I suppose I'd also like to use it as a PBO and render to it, if that's possible? The goal is to apply some mild compression to 4:2:0 video textures.

Bruce

Alfonse Reinheart
07-01-2009, 02:47 PM
And would it do it quickly, i.e. hardware, or slowly as it transfers?

Slowly. Unless you don't care about upload performance (or have no other choice), never tell the driver to compress a texture. Do it offline yourself.


I suppose I'd also like to use it as a PBO and render to it, if that's possible?

You cannot render to compressed texture formats.

Dark Photon
07-02-2009, 08:08 AM
I suppose I'd also like to use it as a PBO and render to it, if that's possible?
You cannot render to compressed texture formats.
I remember Jan Paul and Ignacio doing something like that here: Real-Time YCoCg-DXT Compression (http://developer.nvidia.com/object/real-time-ycocg-dxt-compression.html)

See the paper for details, but the relevent snippet:


DXT Compression on the GPU: ... It is currently not possible to write the results to a DXT-compressed texture directly, but the results can be written to an integer texture...Once the compressed DXT blocks are stored to the texels of an integer texture they need to be copied to the compressed texture. This copy cannot be performed directly. However, an intermediate pixel buffer object (PBO) can be used by copying the contents of the integer texture into the PBO, and then copynig from the PBO to the compressed texture.

Bruce Wheaton
07-06-2009, 11:19 AM
Oh, I have been reading those docs, but I missed that, thanks. The key seems to be that they're doing the calculations in a shader (I don't have the LATC algorithms right now) and then moving it around. In the compression case, I would just pull it back to the CPU then go to the network or disk. On playback, I would push the pre-compressed textures into PBOs then use them.

It is the same idea as all the DXT tricks, but just a 2:1 compression and on separate planes, so I get the benefit with 4:2:0 streams. The DXT methods get better compression but at 4:4:4 only, so you get 4:1 or 8:1 quality but with only a 2:1 or 4:1 compression.

Bruce