Hello.
Has anyone ever done GPU DXT compression? i have seen a couple of resources like this from volition:
Texture Compression in Real-Time Using the GPU
Could it be done using a compute shader as opposed to traditional pipline?
Hello.
Has anyone ever done GPU DXT compression? i have seen a couple of resources like this from volition:
Texture Compression in Real-Time Using the GPU
Could it be done using a compute shader as opposed to traditional pipline?
It is built-in functionality for textures loaded by the application.
And yep, there is an example of compressing an rgtc texture via a compute shader in the superbible. Should be transferrable ...
Ah right okay, ill look that up. This is for pre compressing on the toolside as opposed to runtime, just want to do it on the GPU instead of CPU which is the way i do it at the moment.
if you plan to do that offline, then maybe take an existing solution, e.g.: https://developer.nvidia.com/gpu-accelerated-texture-compression
otherwise, it might take you a while until your GPU solution gonna beat even CPU solutions.
That reminds me of another tool/api i read about. I haven't tried it out.
https://gpuopen.com/gaming-product/compressonator/
1 hour ago, rapso said:if you plan to do that offline, then maybe take an existing solution, e.g.: https://developer.nvidia.com/gpu-accelerated-texture-compression
otherwise, it might take you a while until your GPU solution gonna beat even CPU solutions.
Yeah i looked through the source code of texture tool quite a while back, ive had a DXT compressor running in cpu for ages. So this is more of an excuse to add compute shaders into my engine and accelerate texture processing e.g flipping channels, brightness curves, compressing, mip generation etc.
There's real-time GPU YCoCg-DXT5 compression with example code:
It is slightly newer than the DXT1 in the original post and has much better image quality, although it requires a small change to shaders reading the texture to convert colors from YCoCg to RGB. It's not intended for best-quality-possible offline compression though.
For offline compression, there's at least Intel ISPC texture compressor, which uses CPU but seems "fast enough".
Commercial games are doing runtime GPU BC compression in CS. An example would be virtual/sparse textures where after rendering a "physical" page, it can be compressed to save a LOT of bandwidth in the subsequent frames when it's just sampled. (for example Adaptive Virtual Texture Rendering In Far Cry 4 - see slide 48/53)
I'd recommend looking at some BC (DXT) compression source - like https://github.com/Cyan4973/RygsDXTc/blob/master/stb_dxt.h.
This can actually be ported to compute shader and ran on GPU (as compressing each 4x4 block is independent of each other).
My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com