Important: |
---|
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 memory for Microsoft® Direct3D® Mobile resources is allocated out of memory pools.
Direct3D Mobile supports three types of memory pools: system memory pools, video memory pools, and managed memory pools. System memory pools are located in the device's main memory. Video memory pools are located in memory stores attached directly to the device, typically as part of the display adapter. Managed memory pools are combine both system and video memory.
It is the display driver's responsibility to implement the memory pools on a device. The driver may implement both pools or only the system memory pool (Unified Memory Architecture). A memory pool's type is described by the values in the D3DMPOOLenumeration.
Managed Resources
If a device supports both a system and video memory pool for a particular resource type, such as textures, then those resources may be managed. The memory for image surfaces is never allocated from a managed memory pool.
Managed resources use system memory as a cache for video memory. The algorithm that the driver uses to implement the caching scheme is specific to the driver. It makes sure that textures are loaded into video memory when they are needed for rendering operations.
The application may provide a hint to the driver that a particular resource will be used more frequently by controlling its priority through calls to the IDirect3DMobileResource::SetPrioritymethod.
Display drivers indicate their support for the managed resource pool via the D3DMSURFCAPS_MANAGEDPOOL capability bit (see D3DMSURFCAPS Values). If the driver does not support the managed pool, applications may not create surfaces from it. In this case, the application may handle its own resource management through calls to the IDirect3DMobileDevice::UpdateTexturemethod if the driver supports both system and video memory texture pools.
Surfaces that may be created in the managed pool are vertex buffers, index buffers and texture maps. If managed pool support is implemented in a Direct3D Mobile driver it must include support for vertex buffers, index buffers, and texture buffers. A subset of these types cannot be supported and be in compliance with Direct3D Mobile's definition of a managed pool. Front and back buffers, depth buffers and image surfaces are not allowed to be created in the managed pool.
The application may provide a hint to the driver that a surface should be preloaded into video memory by calling the IDirect3DMobileResource::PreLoadmethod. This method causes the necessary bytes to be discarded and the surface to be loaded immediately.
Finally, the application may also force the resource managed to discard a given number of bytes via the IDirect3DMobileDevice::ResourceManagerDiscardBytesmethod. This method takes as an argument the number of bytes to discard. If the application passes 0 to this method, all managed bytes in video memory are discarded.
Methods that control the resource manager fail if the device does not support the managed pool.