![]() |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The VIDMEMstructure manages the display memory into heaps.
typedef struct _VIDMEM { DWORD dwFlags ; FLATPTR fpStart ; union { FLATPTR fpEnd ; DWORD dwWidth ; }; DDSCAPS ddsCaps ; DDSCAPS ddsCapsAlt ; union { LPVMEMHEAP lpHeap ; DWORD dwHeight ; };} VIDMEM; typedef VIDMEM FAR *LPVIDMEM;
Members
Flag | Usage |
---|---|
VIDMEM_ISHEAP | Reserved for future use. |
VIDMEM_ISLINEAR | Indicates linear memory. |
VIDMEM_ISNONLOCAL | The heap resides in nonlocal (AGP) memory. |
VIDMEM_ISRECTANGULAR | Indicates rectangular memory. |
VIDMEM_ISWC | The driver has enabled write combining on the display memory in this heap. Write combining is a special caching mode in Pentium Pro-class processors that batches writes to the same cache line so they can be transferred in a single bus clock. Write combining does not preserve ordering of the writes, a tradeoff that is usually acceptable for frame buffers. Refer to Intel documentation for more information on write combining. |
Remarks
DirectDraw scans through to allocate its surfaces in the order the display memory heaps are listed. Heaps are managed in an array of VIDMEMstructures. The memory allocated first is the memory that is accessed first. The VIDMEMstructure sets up certain starting points, and determines the amount of memory on the surface and what cannot be done with the surface. DirectDraw manages it by suballocating and deallocating memory, that is, creating and destroying surfaces under each heap's jurisdiction. Physical limits determine how to set up these attributes.
DirectDraw's heap manager makes two passes through the VIDMEMstructures. The ddsCaps member indicates to DirectDraw what the memory in the heap cannot be used for on the first pass. For example, if the heap were just big enough for a back buffer, sprites could be excluded from being allocated on the first pass by setting the DSCAPS_OFFSCREENPLAINflag in the DDSCAPSstructure. That way, other surfaces would fill up with sprites, while preserving the back buffer for page flipping. The ddsCapsAlt member could be set to allow sprites on the second pass (by removing the DSCAPS_OFFSCREENPLAINflag). This allows heaps to be used preferentially for their highest and best use, without ruling out alternative uses. By choosing the order of allocation carefully (for example, by listing the back buffer last), the need to sort by ddsCapsand ddsCapsAltcan sometimes be eliminated.
Last updated on Tuesday, July 13, 2004