Using Extended Surface Alignment
To enable the extended surface alignment functionality, the DirectDraw driver must perform the following tasks at initialization time:
The DdGetDriverInfo callback is called with the GUID_GetHeapAlignment GUID specified. The driver must fill in a DD_GETHEAPALIGNMENTDATA structure, then copy this structure to the lpvData member of the DD_GETDRIVERINFODATA structure.
The driver should fill in the DDSCAPS structure pointed to in the HEAPALIGNMENT structure with the logical OR of the DDSCAPS_xxxx flags for any type of surface that requires alignment in this heap. If a bit in DDSCAPS is set, then DirectDraw abides by the alignment restrictions expressed in the appropriate SURFACEALIGNMENT structure member. The DDSCAPS_FLIP bit and the FlipTarget member apply to surfaces that are back buffers in the primary flipping chain, that is, a potentially primary (visible) surface. The following list shows the currently allowed set of surface capabilities for which alignment can be specified:
Note DirectDraw compares a new surface's capabilities against the entries in the HEAPALIGNMENT structure in the order in which they are specified. For example, a surface with DDSCAPS_MIPMAP | DDSCAPS_TEXTURE | DDSCAPS_FLIP set is aligned according to the Texture member of the HEAPALIGNMENT structure, because this is the first applicable capabilities bit for which an alignment is specified (that is, Texture appears before FlipTarget in the HEAPALIGNMENT structure). The FlipTarget member is not considered in this example. Because back buffers in a primary flipping chain are marked with DDSCAPS_FLIP and no other bit for which an alignment can be specified, such surfaces are aligned according to the FlipTarget member. Surfaces that could potentially become members of a primary flipping chain (those with the same pixel format and size as the primary surface) are also aligned according to the FlipTarget member.