Texture Maps

In DirectX 2, texture maps can be allocated in system memory using the HEL. To allocate a texture map surface, specify the DDSCAPS_TEXTURE flag in the ddsCaps member of the surface description passed to the IDirectDraw::CreateSurface method.

A wide range of texture pixel formats are supported by the HEL. The following table describes these formats. The "Masks" column contains the red, green, blue, and alpha masks for each set of pixel format flags and bit depths.

Pixel Format Flags Bit Depth Masks
DDPF_RGB | 1 R: 0x00000000
DDPF_PALETTEINDEXED1   G: 0x00000000
    B: 0x00000000
    A: 0x00000000
DDPF_RGB | 1 R: 0x00000000
DDPF_PALETTEINDEXED1 |   G: 0x00000000
DDPF_PALETTEINDEXEDTO8   B: 0x00000000
    A: 0x00000000
DDPF_RGB | 2 R: 0x00000000
DDPF_PALETTEINDEXED2   G: 0x00000000
    B: 0x00000000
    A: 0x00000000
DDPF_RGB | 2 R: 0x00000000
DDPF_PALETTEINDEXED2 |   G: 0x00000000
DDPF_PALETTEINDEXEDTO8   B: 0x00000000
    A: 0x00000000
DDPF_RGB | 4 R: 0x00000000
DDPF_PALETTEINDEXED4   G: 0x00000000
    B: 0x00000000
    A: 0x00000000
DDPF_RGB | 4 R: 0x00000000
DDPF_PALETTEINDEXED4 |   G: 0x00000000
DDPF_PALETTEINDEXEDTO8   B: 0x00000000
    A: 0x00000000
DDPF_RGB | 8 R: 0x00000000
DDPF_PALETTEINDEXED8   G: 0x00000000
    B: 0x00000000
    A: 0x00000000
DDPF_RGB 8 R: 0x000000E0
    G: 0x0000001C
    B: 0x00000003
    A: 0x00000000
DDPF_RGB | 16 R: 0x00000F00
DDPF_ALPHAPIXELS   G: 0x000000F0
    B: 0x0000000F
    A: 0x0000F000
DDPF_RGB 16 R: 0x0000F800
    G: 0x000007E0
    B: 0x0000001F
    A: 0x00000000
DDPF_RGB 16 R: 0x0000001F
    G: 0x000007E0
    B: 0x0000F800
    A: 0x00000000
DDPF_RGB 16 R: 0x00007C00
    G: 0x000003E0
    B: 0x0000001F
    A: 0x00000000
DDPF_RGB | 16 R: 0x00007C00
DDPF_ALPHAPIXELS   G: 0x000003E0
    B: 0x0000001F
    A: 0x00008000
DDPF_RGB 24 R: 0x00FF0000
    G: 0x0000FF00
    B: 0x000000FF
    A: 0x00000000
DDPF_RGB 24 R: 0x000000FF
    G: 0x0000FF00
    B: 0x00FF0000
    A: 0x00000000
DDPF_RGB 32 R: 0x00FF0000
    G: 0x0000FF00
    B: 0x000000FF
    A: 0x00000000
DDPF_RGB 32 R: 0x000000FF
    G: 0x0000FF00
    B: 0x00FF0000
    A: 0x00000000
DDPF_RGB | 32 R: 0x00FF0000
DDPF_ALPHAPIXELS   G: 0x0000FF00
    B: 0x000000FF
    A: 0xFF000000
DDPF_RGB | 32 R: 0x000000FF
DDPF_ALPHAPIXELS   G: 0x0000FF00
    B: 0x00FF0000
    A: 0xFF000000

The formats shown in the previous table are those that can be created by the HEL in system memory. The DirectDraw device driver for a 3D-accelerated display card is free to create textures of other formats in display memory. Such a driver should export the DDSCAPS_TEXTURE flag to indicate that it can create textures, and should be prepared to handle the DirectDraw HAL callback CanCreateSurface to verify that the surface description for a texture map is one the driver is prepared to create.