DDS File Layout for Cubic Environment Maps

For cubic environment maps, one or more faces of a cube are written to the file, using either uncompressed or compressed formats, and all faces must be the same size. Each face can have mipmaps defined, although all faces must have the same number of mipmap levels. If a file contains a cube map, DDSCAPS_COMPLEX, DDSCAPS2_CUBEMAP, and one or more of DSCAPS2_CUBEMAP_POSITIVEX/Y/Z and/or DDSCAPS2_CUBEMAP_NEGATIVEX/Y/Z should be set. The faces are written in the order: positive x, negative x, positive y, negative y, positive z, negative z, with any missing faces omitted. Each face is written with its main image, followed by any mipmap levels.

For example, a 256-by-256 cube map with positive x, negative y, and positive z faces, a pixel format of DXT1, and all mipmap levels would contain the following:

Texture Size/Type # Bytes
"DDS ", 256x256, linearsize = 32768, DXT1, 128, (TEXTURE, LINEARSIZE, COMPLEX, MIPMAP, CUBEMAP, POSITIVEX, NEGATIVEY, POSITIVEZ, FOURCC)
256-by-256 positive x main image 32768
128-by-128 positive x mipmap image 8192
64-by-64 positive x mipmap image 2048
32-by-32 positive x mipmap image 512
16-by-16 positive x mipmap image 128
8-by-8 positive x mipmap image 32
4-by-4 positive x mipmap image 8
2-by-2 positive x mipmap image 8
1-by-1 positive x mipmap image 8
256-by-256 negative y main image 32768
128-by-128 negative y mipmap image 8192
64-by-64 negative y mipmap image 2048
32-by-32 negative y mipmap image 512
16-by-16 negative y mipmap image 128
8-by-8 negative y mipmap image 32
4-by-4 negative y mipmap image 8
2-by-2 negative y mipmap image 8
1-by-1 negative y mipmap image 8
256-by-256 positive z main image 32768
128-by-128 positive z mipmap image 8192
64-by-64 positive z mipmap image 2048
32-by-32 positive z mipmap image 512
16-by-16 positive z mipmap image 128
8-by-8 positive z mipmap image 32
4-by-4 positive z mipmap image 8
2-by-2 positive z mipmap image 8
1-by-1 positive z mipmap image 8

Note    As of DirectX 8, cube maps are always written with all faces defined.