D3D11_USAGE
The D3D11_USAGE
enumeration specifies how a ID3D11Resource
is expected to be read from and written to.
Enum Value | Description |
---|---|
D3D11_USAGE_DEFAULT |
Resource is expected to be read and written by the GPU. CPU access is restricted. |
D3D11_USAGE_IMMUTABLE |
Resource is read-only for the GPU. Must be initialized with data at creation; no CPU writes allowed. |
D3D11_USAGE_DYNAMIC |
Resource is mostly written by the CPU and read by the GPU. Use with D3D11_CPU_ACCESS_WRITE . |
D3D11_USAGE_STAGING |
Resource is used for CPU read/write and GPU copy operations. Must be created with appropriate CPU access flags. |
Sample Usage
D3D11_BUFFER_DESC desc = {}; desc.Usage = D3D11_USAGE_DYNAMIC; desc.ByteWidth = sizeof(MyVertex) * vertexCount; desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; device->CreateBuffer(&desc, nullptr, &vertexBuffer);
For a full list of related enums, see D3D11_BIND_FLAG and D3D11_CPU_ACCESS_FLAG.