D3DUSAGE

Usage options that identify how resources are to be used.

The following table summarizes the available usage options.

Constant Description
D3DUSAGE_AUTOGENMIPMAP
The resource will automatically generate mipmaps. See Automatic Generation of Mipmaps (Direct3D 9). 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 (Direct3D 9).
For more information about using dynamic vertex buffers, see Performance Optimizations (Direct3D 9).
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_NONSECURE
Allow a shared surface created by a secure application to be opened by a non-secure application that has the shared handle.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.
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 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_TEXTAPI
This usage flag must be specified for vertex buffers and source surfaces, used in calls to ComposeRects. T extures created with this usage flag cannot be used for texture filtering. Vertex buffers, created with this usage flag, cannot be used as input stream sources.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.
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 may suffer a severe performance penalty. D3DUSAGE_WRITEONLY only affects the performance of D3DPOOL_DEFAULT buffers.
D3DUSAGE_RESTRICTED_CONTENT
Setting this flag indicates that the resource might contain protected content.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.
D3DUSAGE_RESTRICT_SHARED_RESOURCE
Setting this flag indicates that access to the shared resource should be restricted.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.
D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER
Setting this flag indicates that the driver should restrict access to the shared resource. The caller must create an authenticated channel with the driver. The driver should then allow access to processes that attempt to open that shared resource.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only.

Remarks

Usage and Resource Combinations

Usages are either specified when a resource is created, or specified with 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_NONSECURE x 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_TEXTAPI x x
D3DUSAGE_WRITEONLY x x

 

Use 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.

Requirements

Requirement Value
Header
D3d9types.h

See also

Direct3D Constants

D3DUSAGE_QUERY

D3DDECLUSAGE

D3DPOOL