Sign in to follow this  

Compressed and Uncompressed texture, which is faster when sampling texel

This topic is 3630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

From the dx10 document, compressed formats are always decompressed before texture filtering, does it means it will slow the sampling operation? The decompression is done by hardware or by software? or just convert the compressed texture to a normal texture before using it?

Share this post


Link to post
Share on other sites
For all DX10 capable hardware DXT (aka S3TC) formats are decompressed in hardware and won't slow the sampling operation. By using compressed textures more texels fit into the [hardware] texture cache; fewer cache misses means better performance than uncompressed textures (of course if texturing isn't your main bottleneck then you won't see any overall application performance differences).

For older (<=DX9) hardware the situation depends on what the hardware supports. Almost all DX9 class hardware has full DXT support, that said, there are caveats on some vendors hardware that affects the performance of certain flavours of DXT in certain situations.

For DX8 class hardware, many cards support DXT, for those that don't the texture will be decompressed in software before use.

For DX7 class hardware support starts to get patchy and you'll find cards that support only DXT1.

Furthest back (DX6 days IIRC), only S3 cards supported DXT and whether it appears as a DXT format or has to be queried using the S3TC FOURCC depends on the age of the driver.


If you're targetting DX10 then assume all DXT formats are used directly in hardware. For any new project, even one targetting DX8 class hardware I'd use DXT as my primary texture formats.

Share this post


Link to post
Share on other sites
But I just think, even the compressed texture is supported by hardware, when I sample a texel from a normal A8R8G8B8 texture with point filtering, it just need transfer 32bit data from video memory, but when I sample a texel from a dxt1 texture, it need transfer 64bit data and need some extra interpolation work. Maybe in liner filtering mode, compressed texture has its advantage because it sample 4X4 pixel at one time.

Share this post


Link to post
Share on other sites
I ask this because now I have a very big texture, and this texture will be sampled more then 10 times in pixel shader, so I need a balance between performance and video memory. But performance is more critical.

Share this post


Link to post
Share on other sites
DXT decompression is free. DXT saves GPU memory, and thus GPU memory bandwidth during use. As 99% of games are texture/fill/memory bandwidth limited, anything that can ease the burden on memory transfer is a win... assuming the quality loss of DXT is acceptable.

Your example is flawed in that:

1) GPUs don't process a single pixel at once. All modern GPUs tend to process 2x2 pixel blocks, and do many of those at once. So a GPU processing 4 2x2 quads would be doing 16 pixels... That can be handled via a single 64 bit DXT lookup, while you're off doing many reads to fetch your required 512 bits.

2) Even if GPUs didn't operated on pixels in parallel, you're almost certainly not rendering a single pixel. When you're on your third pixel, you will have fetched 96 bits, meanwhile DXT has still only fetched 64 bits, and has only really used 3/16 of that pre-fetched data. Again, by the time the full DXT block has been used, you've fetched 512 bits of data. If your objects are 2 pixels or bigger, DXT wins on a memory fetch comparison.

Share this post


Link to post
Share on other sites
Even with point sampling DXT textures should be faster than equivalent ARGB8 textures. Texture cache should keep decompressed 4x4 pixels around, so the GPU won't need to decompress the same block multiple times.

Share this post


Link to post
Share on other sites

This topic is 3630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this