Compressed Texture Formats (Windows Embedded CE 6.0)
1/6/2010
This section contains information on the internal organization of compressed texture formats. It is useful if you want to operate on compressed surface data directly.
Microsoft® Direct3D® Mobile uses a compression format that divides texture maps into 4x4 texel blocks. If the texture contains no transparency — is opaque — or if the transparency is specified by a one-bit alpha, an 8-byte block represents the texture map block. If the texture map does contain transparent texels, using an alpha channel, a 16-byte block represents it.
Information is contained in the following topics:
- Opaque and One-Bit Alpha Textures
- Textures with Alpha Channels
- Storage Efficiency and Texture Compression
- Mixing Formats Within a Single Texture
Any single texture must specify that its data is stored as 64 or 128 bits per group of 16 texels. If 64-bit blocks — that is, format DXT1 (see D3DMFORMAT) — are used for the texture, it is possible to mix the opaque and one-bit alpha formats on a per-block basis within the same texture. In other words, the comparison of the unsigned integer magnitude of color_0 and color_1 is performed uniquely for each block of 16 texels.
When 128-bit blocks are used, the alpha channel must be specified in either explicit (format DXT2 or DXT3) or interpolated mode (format DXT4 or DXT5) for the entire texture. As with color, once interpolated mode is selected, either eight interpolated alphas or six interpolated alphas mode can be used on a block-by-block basis. Again the magnitude comparison of alpha_0 and alpha_1 is done uniquely on a block-by-block basis.
The pitch for DXTn formats is different from what was returned in DirectX 7. It now refers the pitch of a row of blocks. For example, if you have a width of 16, then you will have a pitch of four blocks (4*8 for DXT1, 4*16 for DXT2-5).