Microsoft DirectX 8.1 (C++) |
Defines the memory class that holds a resource's buffers.
typedef enum _D3DPOOL { D3DPOOL_DEFAULT = 0, D3DPOOL_MANAGED = 1, D3DPOOL_SYSTEMMEM = 2, D3DPOOL_SCRATCH = 3, D3DPOOL_FORCE_DWORD = 0x7fffffff } D3DPOOL;
Resources are placed in the memory pool most appropriate for the set of usages requested for the given resource. This is usually video memory, including both local video memory and AGP memory. The D3DPOOL_DEFAULT pool is separate from D3DPOOL_MANAGED and D3DPOOL_SYTEMMEM, and it specifies that the resource is placed in the preferred memory for device access. Note that D3DPOOL_DEFAULT never indicates that either D3DPOOL_MANAGED or D3DPOOL_SYSTEMMEM should be chosen as the memory pool type for this resource. Textures placed in the D3DPOOL_DEFAULT pool cannot be locked unless they are dynamic textures or they are private (FOURCC) driver formats. To access unlockable textures, you must use functions such as IDirect3DDevice8::CopyRects and IDirect3DDevice8::UpdateTexture. D3DPOOL_MANAGED is probably a better choice than D3DPOOL_DEFAULT for most applications. Also note that some textures created in driver proprietary pixel formats, unknown to the Microsoft® Direct3D® runtime, can be locked. Also note that—unlike textures—swapchain back buffers, render targets, vertex buffers, and index buffers can be locked.
When a device is lost, resources created using D3DPOOL_DEFAULT must be released before calling IDirect3DDevice8::Reset. See Lost Devices for more information.
Pools cannot be mixed for different objects contained within one resource (mip levels in a mipmap), and once a pool is chosen it cannot be changed.
Applications should use D3DPOOL_MANAGED for most static resources because this saves the application from having to deal with lost devices. (Managed resources are restored by the runtime.) This is especially beneficial for UMA systems. Other dynamic resources are not a good match for D3DPOOL_MANAGED. In fact, index buffers and vertex buffers cannot be created using D3DPOOL_MANAGED together with D3DUSAGE_DYNAMIC.
For dynamic textures, it is sometimes desirable to use a pair of video memory and system memory textures, allocating the video memory using D3DPOOL_DEFAULT and the system memory using D3DPOOL_SYSTEMMEM. You can lock and modify the bits of the system memory texture using a locking method. Then you can update the video memory texture using IDirect3DDevice8::UpdateTexture.
Header: Declared in D3d8types.h.
IDirect3DDevice8::CreateCubeTexture, IDirect3DDevice8::CreateIndexBuffer, IDirect3DDevice8::CreateTexture, IDirect3DDevice8::CreateVolumeTexture, IDirect3DDevice8::CreateVertexBuffer, D3DINDEXBUFFER_DESC, D3DSURFACE_DESC, D3DVERTEXBUFFER_DESC, D3DVOLUME_DESC