DDS_HEADER structure

Describes a DDS file header.

Syntax

typedef struct {
  DWORD           dwSize;
  DWORD           dwFlags;
  DWORD           dwHeight;
  DWORD           dwWidth;
  DWORD           dwPitchOrLinearSize;
  DWORD           dwDepth;
  DWORD           dwMipMapCount;
  DWORD           dwReserved1[11];
  DDS_PIXELFORMAT ddspf;
  DWORD           dwCaps;
  DWORD           dwCaps2;
  DWORD           dwCaps3;
  DWORD           dwCaps4;
  DWORD           dwReserved2;
} DDS_HEADER;

Members

dwSize

Type: DWORD

Size of structure. This member must be set to 124.

dwFlags

Type: DWORD

Flags to indicate which members contain valid data.

Flag Description Value
DDSD_CAPS Required in every .dds file. 0x1
DDSD_HEIGHT Required in every .dds file. 0x2
DDSD_WIDTH Required in every .dds file. 0x4
DDSD_PITCH Required when pitch is provided for an uncompressed texture. 0x8
DDSD_PIXELFORMAT Required in every .dds file. 0x1000
DDSD_MIPMAPCOUNT Required in a mipmapped texture. 0x20000
DDSD_LINEARSIZE Required when pitch is provided for a compressed texture. 0x80000
DDSD_DEPTH Required in a depth texture. 0x800000

Note

When you write .dds files, you should set the DDSD_CAPS and DDSD_PIXELFORMAT flags, and for mipmapped textures you should also set the DDSD_MIPMAPCOUNT flag. However, when you read a .dds file, you should not rely on the DDSD_CAPS, DDSD_PIXELFORMAT, and DDSD_MIPMAPCOUNT flags being set because some writers of such a file might not set these flags.

The DDS_HEADER_FLAGS_TEXTURE flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSD_CAPS, DDSD_HEIGHT, DDSD_WIDTH, and DDSD_PIXELFORMAT flags.

The DDS_HEADER_FLAGS_MIPMAP flag, which is defined in Dds.h, is equal to the DDSD_MIPMAPCOUNT flag.

The DDS_HEADER_FLAGS_VOLUME flag, which is defined in Dds.h, is equal to the DDSD_DEPTH flag.

The DDS_HEADER_FLAGS_PITCH flag, which is defined in Dds.h, is equal to the DDSD_PITCH flag.

The DDS_HEADER_FLAGS_LINEARSIZE flag, which is defined in Dds.h, is equal to the DDSD_LINEARSIZE flag.

dwHeight

Type: DWORD

Surface height (in pixels).

dwWidth

Type: DWORD

Surface width (in pixels).

dwPitchOrLinearSize

Type: DWORD

The pitch or number of bytes per scan line in an uncompressed texture; the total number of bytes in the top level texture for a compressed texture. For information about how to compute the pitch, see the DDS File Layout section of the Programming Guide for DDS.

dwDepth

Type: DWORD

Depth of a volume texture (in pixels), otherwise unused.

dwMipMapCount

Type: DWORD

Number of mipmap levels, otherwise unused.

dwReserved1[11]

Type: DWORD

Unused.

ddspf

Type: DDS_PIXELFORMAT

The pixel format (see DDS_PIXELFORMAT).

dwCaps

Type: DWORD

Specifies the complexity of the surfaces stored.

Flag Description Value
DDSCAPS_COMPLEX Optional; must be used on any file that contains more than one surface (a mipmap, a cubic environment map, or mipmapped volume texture). 0x8
DDSCAPS_MIPMAP Optional; should be used for a mipmap. 0x400000
DDSCAPS_TEXTURE Required 0x1000

Note

When you write .dds files, you should set the DDSCAPS_TEXTURE flag, and for multiple surfaces you should also set the DDSCAPS_COMPLEX flag. However, when you read a .dds file, you should not rely on the DDSCAPS_TEXTURE and DDSCAPS_COMPLEX flags being set because some writers of such a file might not set these flags.

The DDS_SURFACE_FLAGS_MIPMAP flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS_COMPLEX and DDSCAPS_MIPMAP flags.

The DDS_SURFACE_FLAGS_TEXTURE flag, which is defined in Dds.h, is equal to the DDSCAPS_TEXTURE flag.

The DDS_SURFACE_FLAGS_CUBEMAP flag, which is defined in Dds.h, is equal to the DDSCAPS_COMPLEX flag.

dwCaps2

Type: DWORD

Additional detail about the surfaces stored.

Flag Description Value
DDSCAPS2_CUBEMAP Required for a cube map. 0x200
DDSCAPS2_CUBEMAP_POSITIVEX Required when these surfaces are stored in a cube map. 0x400
DDSCAPS2_CUBEMAP_NEGATIVEX Required when these surfaces are stored in a cube map. 0x800
DDSCAPS2_CUBEMAP_POSITIVEY Required when these surfaces are stored in a cube map. 0x1000
DDSCAPS2_CUBEMAP_NEGATIVEY Required when these surfaces are stored in a cube map. 0x2000
DDSCAPS2_CUBEMAP_POSITIVEZ Required when these surfaces are stored in a cube map. 0x4000
DDSCAPS2_CUBEMAP_NEGATIVEZ Required when these surfaces are stored in a cube map. 0x8000
DDSCAPS2_VOLUME Required for a volume texture. 0x200000

The DDS_CUBEMAP_POSITIVEX flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS2_CUBEMAP and DDSCAPS2_CUBEMAP_POSITIVEX flags.

The DDS_CUBEMAP_NEGATIVEX flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS2_CUBEMAP and DDSCAPS2_CUBEMAP_NEGATIVEX flags.

The DDS_CUBEMAP_POSITIVEY flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS2_CUBEMAP and DDSCAPS2_CUBEMAP_POSITIVEY flags.

The DDS_CUBEMAP_NEGATIVEY flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS2_CUBEMAP and DDSCAPS2_CUBEMAP_NEGATIVEY flags.

The DDS_CUBEMAP_POSITIVEZ flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS2_CUBEMAP and DDSCAPS2_CUBEMAP_POSITIVEZ flags.

The DDS_CUBEMAP_NEGATIVEZ flag, which is defined in Dds.h, is a bitwise-OR combination of the DDSCAPS2_CUBEMAP and DDSCAPS2_CUBEMAP_NEGATIVEZ flags.

The DDS_CUBEMAP_ALLFACES flag, which is defined in Dds.h, is a bitwise-OR combination of the DDS_CUBEMAP_POSITIVEX, DDS_CUBEMAP_NEGATIVEX, DDS_CUBEMAP_POSITIVEY, DDS_CUBEMAP_NEGATIVEY, DDS_CUBEMAP_POSITIVEZ, and DDSCAPS2_CUBEMAP_NEGATIVEZ flags.

The DDS_FLAGS_VOLUME flag, which is defined in Dds.h, is equal to the DDSCAPS2_VOLUME flag.

Note

Although Direct3D 9 supports partial cube-maps, Direct3D 10, 10.1, and 11 require that you define all six cube-map faces (that is, you must set DDS_CUBEMAP_ALLFACES).

dwCaps3

Type: DWORD

Unused.

dwCaps4

Type: DWORD

Unused.

dwReserved2

Type: DWORD

Unused.

Remarks

Include flags in dwFlags for the members of the structure that contain valid data.

Use this structure in combination with a DDS_HEADER_DXT10 to store a resource array in a DDS file. For more information, see texture arrays.

DDS_HEADER is identical to the DirectDraw DDSURFACEDESC2 structure without DirectDraw dependencies.

Requirements

Requirement Value
Header
Dds.h

See also

Reference for DDS