共用方式為


Managing Resources

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Resource management is the process where resources are promoted from system-memory storage to device-accessible storage and discarded from device-accessible storage. The Microsoft® Direct3®D Mobile run time has its own management algorithm based on a least-recently-used priority technique. Direct3D Mobile switches to a most-recently-used priority technique when it detects that more resources than can coexist in device-accessible memory are used in a single frame — between IDirect3DMobileDevice::BeginScene and IDirect3DMobileDevice::EndScene calls.

Use the D3DMPOOL_MANAGED flag at creation time to specify a managed resource. Managed resources persist through transitions between the lost and operational states of the device. The device can be restored with a call to IDirect3DMobileDevice::Reset, and such resources continue to function normally without being reloaded with artwork. However, if the device must be destroyed and recreated, all resources created using D3DMPOOL_MANAGED must be recreated.

Use the D3DMPOOL_DEFAULT flag at creation time to specify that a resource be placed in the default pool. Resources in the default pool do not persist through transitions between the lost and operational states of the device. These resources must be released before calling Reset and must then be recreated.

For more information on the lost state of a device, see Lost Devices.

Note that resource management is not supported for all types and usages. For example, objects created with the D3DUSAGE_RENDERTARGET flag are not supported. In addition, resource management is not recommended for objects whose contents are changing with high frequency. For example, a managed vertex buffer that changes every frame can significantly degrade performance for some hardware. However, this is not a problem for texture resources.

See Also

Concepts

Common Details for Direct3D Mobile Resources