Microsoft DirectX 8.1 (Visual Basic)

CONST_D3DPOOL

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

Constants

D3DPOOL_DEFAULT

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.

D3DPOOL_MANAGED
Resources will be copied automatically to device-accessible memory as needed. Managed resources are backed by system memory, and do not need to be recreated when a device is lost. See Managing Resources for more information. Managed resources can be locked. Only the system-memory copy is directly modified. Direct3D copies your changes to driver accessible memory as needed.
D3DPOOL_SYSTEMMEM
Memory that is not typically accessible by the 3-D device. This flag consumes system RAM but does not reduce pageable RAM. These resources do not need to be recreated when a device is lost. Resources in this pool can be locked, and they can be used as the source for a Direct3DDevice8.CopyRects or Direct3DDevice8.UpdateTexture operation to a memory resource created with D3DPOOL_DEFAULT.
D3DPOOL_SCRATCH
Resources are placed in system RAM, so you do not need to re-create them when a device is lost. These resources are not bound by device size or format restrictions. Because of this, these resources cannot be accessed by the Direct3D device nor set as textures or render targets. However, these resources can always be created, locked, and copied.

Remarks

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.

See Also

Direct3DDevice8.CreateCubeTexture, Direct3DDevice8.CreateIndexBuffer, Direct3DDevice8.CreateTexture, Direct3DDevice8.CreateVertexBuffer, Direct3DDevice8.CreateVolumeTexture, D3DINDEXBUFFER_DESC, D3DSURFACE_DESC, D3DVERTEXBUFFER_DESC, D3DVOLUME_DESC