Technique:Block-compressed texture formats
| On this wiki | Facts · Code · Notes · Topics |
|---|
Recognition notes for the GPU block-compressed texture formats games ship (BC1-BC7 / DXT, ETC, ASTC): fixed-size blocks of texels, so a mip level's size follows from the block size alone.
The idea
Block compression stores each rectangle of texels (4x4 for BC and ETC, 4x4 to 12x12 for ASTC) in a fixed number of bytes, so the GPU can address and decode per block. The size of a level is ceil(width/blockW) * ceil(height/blockH) * bytesPerBlock; DirectXTex ComputePitch does exactly this (with a "bad DXTn tails" mode that rounds down for files written that way).
BC (S3TC/DXT) family, 4x4 texels per block
| Format | FourCC in DDS | Bytes per block | Contents |
|---|---|---|---|
| BC1 | DXT1 | 8 | two RGB565 endpoints (uint16 x2) and a 2-bit-per-texel index bitmap (uint32) |
| BC2 | DXT2/DXT3 | 16 | 4-bit-per-texel explicit alpha bitmap (two uint32), then a BC1 color block |
| BC3 | DXT4/DXT5 | 16 | two alpha endpoints (u8 x2), 3-bit-per-texel alpha indices (6 bytes), then a BC1 color block |
| BC4 | ATI1, BC4U/BC4S | 8 | one channel |
| BC5 | ATI2, BC5U/BC5S | 16 | two channels |
| BC6H | BC6H | 16 | HDR RGB (UF16 unsigned, SF16 signed) |
| BC7 | BC7L / via DX10 | 16 | high-quality RGB(A) |
Bytes per block come from DirectXTex BytesPerBlock; the BC1 to BC3 struct layouts from its BC.h. Unverified: that BC4 is coded like the BC3 alpha block and BC5 is two BC4 blocks; the BC6H and BC7 mode-bit layouts (the mode is in the first bits of the block). To confirm read DirectXTex BC4BC5.cpp, BC6HBC7.cpp.
Containers
- Format:DDS (DirectDraw Surface) (FourCC or DXGI_FORMAT)
- Format:KTX and KTX2 (Khronos texture) (GL internal format or vkFormat)
- Format:BNTX, Format:VTF (Valve Texture Format), Format:TPL texture palette for console and engine containers
- Format:ASTC file (.astc) for ASTC alone, Format:Basis Universal (.basis) for transcodable data
ASTC and ETC
Every ASTC block is 16 bytes whatever the footprint (astcenc computes data size with 16 per block). Unverified: ETC1 and ETC2 RGB blocks are 4x4 texels in 8 bytes, ETC2 RGBA 16 bytes.
Code & repositories
- https://github.com/microsoft/DirectXTex @
4234f77df9c6c8bb2880607b82d5d597b54d1fa9· license: MIT
Reference DDS reader/writer (DDS.h, DirectXTexDDS.cpp) and BC1-BC7 codecs; MIT
Tested on: source read, not run: source read, no build · checked 2026-10-19; last activity 2026-10-16; Note: the latest release ships binaries; the wiki links only the source, never the binaries