D3D11_BUFFER_DESC Structure (d3d11)
Represents a buffer resource.
typedef struct D3D11_BUFFER_DESC {
UINT ByteWidth;
D3D11_USAGE Usage;
UINT BindFlags;
UINT CPUAccessFlags;
UINT MiscFlags;
UINT StructureByteStride;
} D3D11_BUFFER_DESC;
Remarks
Use this structure to describe a buffer resource that you want to create. A buffer resource is a contiguous block of memory that can be accessed by the CPU and/or the GPU. Buffers can be used for various purposes, such as storing vertex data, index data, constant data, unordered access data, and more.
When you create a buffer, you pass a pointer to a
D3D11_BUFFER_DESC
structure to the
ID3D11Device::CreateBuffer
method.
The following table describes the members of the
D3D11_BUFFER_DESC
structure.
Members
Member | Description |
---|---|
ByteWidth |
The size of the buffer in bytes. The minimum size is 1 byte. |
Usage |
A D3D11_USAGE-typed value that specifies how the buffer will be used.
Possible values include D3D11_USAGE_DEFAULT ,
D3D11_USAGE_IMMUTABLE ,
D3D11_USAGE_DYNAMIC , and
D3D11_USAGE_STAGING .
|
BindFlags |
A D3D11_BIND_FLAG-typed value that specifies how the buffer will be bound to the pipeline.
Possible values include D3D11_BIND_VERTEX_BUFFER ,
D3D11_BIND_INDEX_BUFFER ,
D3D11_BIND_CONSTANT_BUFFER ,
D3D11_BIND_SHADER_RESOURCE ,
D3D11_BIND_STREAM_OUTPUT ,
D3D11_BIND_UNORDERED_ACCESS .
Flags can be combined using the bitwise OR operator.
|
CPUAccessFlags |
A D3D11_CPU_ACCESS_FLAG-typed value that specifies the CPU access capabilities of the buffer.
Possible values include D3D11_CPU_ACCESS_READ ,
D3D11_CPU_ACCESS_WRITE .
Flags can be combined using the bitwise OR operator.
|
MiscFlags |
A D3D11_RESOURCE_MISC_FLAG-typed value that specifies miscellaneous flags for the buffer.
Possible values include D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS ,
D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS ,
D3D11_RESOURCE_MISC_BUFFER_STRUCTURED .
Flags can be combined using the bitwise OR operator.
|
StructureByteStride |
The size of each element in bytes when the buffer is used as a structured buffer (i.e., when
D3D11_RESOURCE_MISC_BUFFER_STRUCTURED is set in MiscFlags ).
If the buffer is not a structured buffer, this member is ignored (typically set to 0).
|
Note
The combination of Usage
, BindFlags
, and CPUAccessFlags
determines the performance characteristics of the buffer. For example, a buffer that is
frequently updated by the CPU and read by the GPU should have
D3D11_USAGE_DYNAMIC
and D3D11_CPU_ACCESS_WRITE
.
Requirements
Technical | Value |
---|---|
Header | d3d11.h |