Microsoft DirectX 8.1 (Visual Basic) |
Defines the memory class that holds a resource's buffers.
Enum CONST_D3DPOOL D3DPOOL_DEFAULT = 0 D3DPOOL_MANAGED = 1 D3DPOOL_SYSTEMMEM = 2 D3DPOOL_SCRATCH = 3 End Enum
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 specifies that the resource will be 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 and are therefore not directly accessible. Instead you must use functions such as Direct3DDevice8.CopyRects and Direct3dDevice8.UpdateTexture. D3DPOOL_MANAGED is probably a better choice than D3DPOOL_DEFAULT for most applications. 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 becomes lost, resources created using D3DPOOL_DEFAULT must be released before calling Direct3DDevice8.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, as this isolates the application from dealing with lost device situations. (Managed resources are restored by the runtime.) This is especially beneficial for UMA systems. Dynamic texture resources can also be a good match for D3DPOOL_MANAGED, in spite of the high frequency at which they change. 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 Direct3DDevice8.UpdateTexture.
Direct3DDevice8.CreateCubeTexture, Direct3DDevice8.CreateIndexBuffer, Direct3DDevice8.CreateTexture, Direct3DDevice8.CreateVertexBuffer, Direct3DDevice8.CreateVolumeTexture, D3DINDEXBUFFER_DESC, D3DSURFACE_DESC, D3DVERTEXBUFFER_DESC, D3DVOLUME_DESC