Platform SDK: DirectX

DDSURFACEDESC2

The DDSURFACEDESC2 structure contains a description of a surface. This structure is used to pass surface parameters to the IDirectDraw7::CreateSurface and IDirectDrawSurface7::SetSurfaceDesc methods. It is also used to retrieve information about a surface in calls to IDirectDrawSurface7::Lock and IDirectDrawSurface7::GetSurfaceDesc. The relevant members differ for each potential type of surface.

typedef struct _DDSURFACEDESC2 {
    DWORD         dwSize;
    DWORD         dwFlags;
    DWORD         dwHeight;
    DWORD         dwWidth;
    union
    {
        LONG      lPitch;
        DWORD     dwLinearSize;
    } DUMMYUNIONNAMEN(1);
    DWORD         dwBackBufferCount;
    union
    {
        DWORD     dwMipMapCount;
        DWORD     dwRefreshRate;
    } DUMMYUNIONNAMEN(2);
    DWORD         dwAlphaBitDepth;
    DWORD         dwReserved;
    LPVOID        lpSurface;
    union
    {
        DDCOLORKEY    ddckCKDestOverlay;
        DWORD         dwEmptyFaceColor;
    } DUMMYUNIONNAMEN(3);
    DDCOLORKEY    ddckCKDestBlt;
    DDCOLORKEY    ddckCKSrcOverlay;
    DDCOLORKEY    ddckCKSrcBlt;
    DDPIXELFORMAT ddpfPixelFormat;
    DDSCAPS2      ddsCaps;
    DWORD         dwTextureStage;
} DDSURFACEDESC2, FAR* LPDDSURFACEDESC2; 

Members

dwSize
Size of the structure, in bytes. This member must be initialized before the structure is used.
dwFlags
Optional control flags. One or more of the following flags:
DDSD_ALL
All input members are valid.
DDSD_ALPHABITDEPTH
The dwAlphaBitDepth member is valid.
DDSD_BACKBUFFERCOUNT
The dwBackBufferCount member is valid.
DDSD_CAPS
The ddsCaps member is valid.
DDSD_CKDESTBLT
The ddckCKDestBlt member is valid.
DDSD_CKDESTOVERLAY
The ddckCKDestOverlay member is valid.
DDSD_CKSRCBLT
The ddckCKSrcBlt member is valid.
DDSD_CKSRCOVERLAY
The ddckCKSrcOverlay member is valid.
DDSD_HEIGHT
The dwHeight member is valid.
DDSD_LINEARSIZE
The dwLinearSize member is valid.
DDSD_LPSURFACE
The lpSurface member is valid.
DDSD_MIPMAPCOUNT
The dwMipMapCount member is valid.
DDSD_PITCH
The lPitch member is valid.
DDSD_PIXELFORMAT
The ddpfPixelFormat member is valid.
DDSD_REFRESHRATE
The dwRefreshRate member is valid.
DDSD_TEXTURESTAGE
The dwTextureStage member is valid.
DDSD_WIDTH
The dwWidth member is valid.
DDSD_ZBUFFERBITDEPTH
Obsolete; see Remarks.
dwHeight and dwWidth
Dimensions of the surface to be created, in pixels.
lPitch
Distance, in bytes, to the start of next line. When used with the IDirectDrawSurface7::GetSurfaceDesc method, this is a return value. When used with the IDirectDrawSurface7::SetSurfaceDesc method, this is an input value that must be a DWORD multiple. For more information, see Remarks.
dwLinearSize
Size of the buffer. Currently returned only for compressed texture surfaces.
dwBackBufferCount
Number of back buffers.
dwMipMapCount
Number of mipmap levels.
dwRefreshRate
Refresh rate (used when the display mode is described). The value of 0 indicates an adapter default.
dwAlphaBitDepth
Depth of the alpha buffer.
dwReserved
Reserved.
lpSurface
Address of the associated surface memory. When calling IDirectDrawSurface7::Lock, this member is a valid pointer to surface memory. When calling IDirectDrawSurface7::SetSurfaceDesc, this member is a pointer to system memory that the caller explicitly allocates for the DirectDrawSurface object. For more information, see Remarks.
ddckCKDestOverlay
DDCOLORKEY structure that describes the destination color key for an overlay surface.
dwEmptyFaceColor
Physical color for empty cubemap faces.
ddckCKDestBlt
DDCOLORKEY structure that describes the destination color key for blit operations.
ddckCKSrcOverlay
DDCOLORKEY structure that describes the source color key for an overlay surface.
ddckCKSrcBlt
DDCOLORKEY structure that describes the source color key for blit operations.
ddpfPixelFormat
DDPIXELFORMAT structure that describes the pixel format of the surface.
ddsCaps
DDSCAPS2 structure that contains the capabilities of the surface.
dwTextureStage
Stage identifier used to bind a texture to a specific stage in a multitexture cascade 3-D device. Although not required for all hardware, setting this member is recommended for best performance on the largest variety of 3-D accelerators. Hardware that requires explicitly assigned textures exposes the D3DDEVCAPS_SEPARATETEXTUREMEMORIES 3-D device capability in the D3DDEVICEDESC structure that is filled by the IDirect3DDevice7::GetCaps method.

Remarks

The lPitch and lpSurface members are output values when calling the IDirectDrawSurface7::GetSurfaceDesc method. When creating surfaces from existing memory or updating surface characteristics, these members are input values that describe the pitch and location of memory allocated by the calling application for use by DirectDraw. DirectDraw does not attempt to manage or free memory allocated by the application. For more information, see Creating Client Memory Surfaces and Updating Surface Characteristics.

This structure is nearly identical to the DDSURFACEDESC structure, but contains a DDSCAPS2 structure as the ddsCaps member. Unlike DDSURFACEDESC, this structure does not contain the dwZBufferBitDepth member. Z-buffer depth is provided in the ddpfPixelFormat member.

The unions in this structure work with compilers that do not support nameless unions. If your compiler does not support nameless unions, define the NONAMELESSUNION token before including the Ddraw.h header file.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in ddraw.h.