DirectX SDK |
The DirectDraw7.GetAvailableTotalMem method retrieves the total amount of display memory available for a given type of surface.
object.GetAvailableTotalMem( _ ddsCaps As DDSCAPS2) As Long
If the method succeeds, it returns the amount of total memory.
If the method fails, it raises an error, and Err.Number can be set to one of the following values:
DDERR_INVALIDCAPS |
DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS |
DDERR_NODIRECTDRAWHW |
This method provides only a snapshot of the current display-memory state. The amount of free display memory is subject to change as surfaces are created and released. Therefore, you should use the free memory value only as an approximation. In addition, a particular display adapter card might make no distinction between two different memory types. For example, the adapter might use the same portion of display memory to store z-buffers and textures, so allocating one type of surface (for example, a z-buffer) can affect the amount of display memory available for another type of surface (textures). Therefore, it is best to first allocate an application's fixed resources (such as front and back buffers , and z-buffers) before determining how much memory is available for dynamic use (such as texture mapping).