Resource Management by Direct3D Mobile Drivers (Windows Embedded CE 6.0)
1/6/2010
When an application makes the call to create a resource, it passes passing a D3Dmpool value to specify which memory pool that resource should be created from. When the application specifies D3DMPOOL_MANAGED, the Direct3D® Mobile driver is responsible for managing how memory is allocated for resources. The driver controls whether resources are allocated from the system memory pool, the video memory pool, or a managed pool consisting of both system and video memory. For more information, see Memory Pools in Direct3D Mobile.
A driver that supports a managed memory pool indicates its support for this type of pool by exposing the D3DMSURFCAPS_MANAGEDPOOL capability bit. To support a managed pool, the driver must implement the D3DM_ResourceManager function. Even if the driver does not support the managed pool, it must load the pointer for this function in the D3DM_INITIALIZE_DATA structure with a valid function pointer.
When a texture or other resource is created in a managed pool, the driver allocates space in the system memory pool for the texture. When the texture is assigned to a texture stage, through a call to IDirect3DMobileDevice::SetTexture, the texture driver uploads the texture into the video memory pool. The driver holds the texture in the video memory pool until it is the least recently used (LRU) item in video memory and until the space is needed for a different resource, at which time the texture is removed. When video memory needs room to upload a managed surface, and there are identical LRU counts, the driver should clear memory based on surface priority.