D3DUSAGE

Usage options that identify how resources are to be used.

Usages

The following table summarizes the available usage options.

#define Description
D3DUSAGE_AUTOGENMIPMAP The resource will automatically generate mipmaps. See Automatic Generation of Mipmaps. Automatic generation of mipmaps is not supported for volume textures and depth stencil surfaces/textures. This usage is not valid for a resource in system memory (D3DPOOL_SYSTEMMEM).
D3DUSAGE_DEPTHSTENCIL The resource will be a depth stencil buffer. D3DUSAGE_DEPTHSTENCIL can only be used with D3DPOOL_DEFAULT.
D3DUSAGE_DMAP The resource will be a displacement map.
D3DUSAGE_DONOTCLIP Set to indicate that the vertex buffer content will never require clipping. When rendering with buffers that have this flag set, the D3DRS_CLIPPING render state must be set to false.
D3DUSAGE_DYNAMIC

Set to indicate that the vertex buffer requires dynamic memory use. This is useful for drivers because it enables them to decide where to place the buffer. In general, static vertex buffers are placed in video memory and dynamic vertex buffers are placed in AGP memory. Note that there is no separate static use. If you do not specify D3DUSAGE_DYNAMIC, the vertex buffer is made static. D3DUSAGE_DYNAMIC is strictly enforced through the D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE locking flags. As a result, D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE are valid only on vertex buffers created with D3DUSAGE_DYNAMIC. They are not valid flags on static vertex buffers. For more information, see Managing Resources.

For more information about using dynamic vertex buffers, see Performance Optimizations.

D3DUSAGE_DYNAMIC and D3DPOOL_MANAGED are incompatible and should not be used together. See D3DPOOL.

Textures can specify D3DUSAGE_DYNAMIC. However, managed textures cannot use D3DUSAGE_DYNAMIC. For more information about dynamic textures, see Using Dynamic Textures.

D3DUSAGE_NPATCHES Set to indicate that the vertex buffer is to be used for drawing N-patches.
D3DUSAGE_POINTS Set to indicate that the vertex or index buffer will be used for drawing point sprites. The buffer will be loaded in system memory if software vertex processing is needed to emulate point sprites.
D3DUSAGE_RENDERTARGET The resource will be a render target. D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT.
D3DUSAGE_RTPATCHES Set to indicate that the vertex buffer is to be used for drawing high-order primitives.
D3DUSAGE_SOFTWAREPROCESSING

If this flag is used, vertex processing is done in software. If this flag is not used, vertex processing is done in hardware.

The D3DUSAGE_SOFTWAREPROCESSING flag can be set when mixed-mode or software vertex processing (D3DCREATE_MIXED_VERTEXPROCESSING / D3DCREATE_SOFTWARE_VERTEXPROCESSING) is enabled for that device. D3DUSAGE_SOFTWAREPROCESSING must be set for buffers to be used with software vertex processing in mixed mode, but it should not be set for the best possible performance when using hardware index processing in mixed mode (D3DCREATE_HARDWARE_VERTEXPROCESSING). However, setting D3DUSAGE_SOFTWAREPROCESSING is the only option when a single buffer is used with both hardware and software vertex processing. D3DUSAGE_SOFTWAREPROCESSING is allowed for mixed and software devices.

D3DUSAGE_SOFTWAREPROCESSING is used with IDirect3D9::CheckDeviceFormat to find out if a particular texture format can be used as a vertex texture during software vertex processing. If it can, the texture must be created in D3DPOOL_SCRATCH.

D3DUSAGE_WRITEONLY Informs the system that the application writes only to the vertex buffer. Using this flag enables the driver to choose the best memory location for efficient write operations and rendering. Attempts to read from a vertex buffer that is created with this capability will fail. Buffers created with D3DPOOL_DEFAULT that do not specify D3DUSAGE_WRITEONLY might suffer a severe performance penalty.

Usage and Resource Combinations

Usages are either specified when a resource is created, or specified with IDirect3D9::CheckDeviceType to test the capability of an existing resource. The following table identifies which usages can be applied to which resource types.

Usage Vertex buffer create Index buffer create Texture create Cube texture create Volume texture create Surface create Check device format
D3DUSAGE_AUTOGENMIPMAP x x x
D3DUSAGE_DEPTHSTENCIL x x x x
D3DUSAGE_DMAP x x
D3DUSAGE_DONOTCLIP x x
D3DUSAGE_DYNAMIC x x x x x x
D3DUSAGE_NPATCHES x x
D3DUSAGE_POINTS x x
D3DUSAGE_RTPATCHES x x
D3DUSAGE_RENDERTARGET x x x x
D3DUSAGE_SOFTWAREPROCESSING x x x x x x
D3DUSAGE_WRITEONLY x x

Use IDirect3D9::CheckDeviceFormat to check hardware support for these usages.

Each of the resource creation methods is listed here.

The D3DXCreatexxx texturing functions also use some of these constant values for resource creation.

For more information about pool types and their restrictions with certain usages, see D3DPOOL.

Constant Information

Header d3d9types.h
Minimum operating system Windows 98

See Also

D3DUSAGE_QUERY, D3DDECLUSAGE, D3DPOOL