D3D10_USAGE enumeration (d3d10.h)
Identifies expected resource use during rendering. The usage directly reflects whether a resource is accessible by the CPU and/or the GPU.
Syntax
typedef enum D3D10_USAGE {
D3D10_USAGE_DEFAULT = 0,
D3D10_USAGE_IMMUTABLE = 1,
D3D10_USAGE_DYNAMIC = 2,
D3D10_USAGE_STAGING = 3
} ;
Constants
D3D10_USAGE_DEFAULT Value: 0 A resource that requires read and write access by the GPU. This is likely to be the most common usage choice. |
D3D10_USAGE_IMMUTABLE Value: 1 A resource that can only be read by the GPU. It cannot be written by the GPU, and cannot be accessed at all by the CPU. This type of resource must be initialized when it is created, since it cannot be changed after creation. |
D3D10_USAGE_DYNAMIC Value: 2 A resource that is accessible by both the GPU and the CPU (write only). A dynamic resource is a good choice for a resource that will be updated by the CPU at least once per frame. To write to a dynamic resource on the CPU, use a Map method. You can write to a dynamic resource on the GPU using CopyResource or CopySubresourceRegion. |
D3D10_USAGE_STAGING Value: 3 A resource that supports data transfer (copy) from the GPU to the CPU. |
Remarks
An application identifies the way a resource is intended to be used (its usage) in a resource description. There are several structures for creating resources including: D3D10_TEXTURE1D_DESC, D3D10_TEXTURE2D_DESC, D3D10_TEXTURE3D_DESC, D3D10_BUFFER_DESC, and D3DX10_IMAGE_LOAD_INFO.
Differences between Direct3D 9 and Direct3D 10:
In Direct3D 9, you specify the type of memory a resource should be created in at resource creation time (using D3DPOOL). It was an application's job to decide what memory pool would provide the best combination of functionality and performance. In Direct3D 10, an application no longer specifies what type of memory (the pool) to create a resource in. Instead, you specify the intended usage of the resource, and let the runtime (in concert with the driver and a memory manager) choose the type of memory that will achieve the best performance. |
Resource Usage Restrictions
Each usage dictates a tradeoff between functionality and performance. In general, resource accessing is accomplished with the following APIs.- CPU access is done with ID3D10Buffer::Map, ID3D10Texture1D::Map, ID3D10Texture2D::Map, or ID3D10Texture3D::Map
- GPU access is done with CopySubresourceRegion, CopyResource, or UpdateSubresource.
Resource Usage | Default | Dynamic | Immutable | Staging |
---|---|---|---|---|
GPU-Read | yes | yes¹ | yes | yes1, 2 |
GPU-Write | yes¹ | yes1, 2 | ||
CPU-Read | yes1, 2 | |||
CPU-Write | yes | yes1, 2 |
- 1 - This is restricted to CopySubresourceRegion, CopyResource, and UpdateSubresource.
- 2 - Cannot be a depth-stencil buffer or a multisampled render target.
Resource Bind Options
To maximize performance, not all resource usage options can be used as input or output resources to the pipeline. This table identifies these limitations.Resource Can Be Bound As | Default | Dynamic | Immutable | Staging |
---|---|---|---|---|
Input to a Stage | yes³ | yes⁴ | yes | |
Output from a Stage | yes³ |
- 3 - If bound as an input and an output using different views, each view must use different subresources.
- 4 - The resource can only be created with a single subresource. The resource cannot be a texture array. The resource cannot be a mipmap chain.
Requirements
Requirement | Value |
---|---|
Header | d3d10.h |