D3D11_BUFFER_DESC Structure

Describes a buffer resource.

Syntax

typedef struct D3D11_BUFFER_DESC {
    UINT ByteWidth;
    D3D11_USAGE Usage;
    UINT BindFlags;
    UINT CPUAccessFlags;
    UINT MiscFlags;
    UINT StructureByteStride;
    UINT ESRAMOffsetBytes;
    UINT ESRAMUsageBytes;
} D3D11_BUFFER_DESC;  

Members

ByteWidth
Size of the buffer in bytes.

Usage
Identify how the buffer is expected to be read from and written to. Frequency of update is a key factor. The most common value is typically D3D11_USAGE_DEFAULT; see D3D11_USAGE for all possible values.

BindFlags
Identify how the buffer will be bound to the pipeline. Flags (see D3D11_BIND_FLAG) can be combined with a logical OR.

CPUAccessFlags
CPU access flags (see D3D11_CPU_ACCESS_FLAG) or 0 if no CPU access is necessary. Flags can be combined with a logical OR.

MiscFlags
Miscellaneous flags (see D3D11_RESOURCE_MISC_FLAG) or 0 if unused. Flags can be combined with a logical OR.

StructureByteStride

The size of each element in the buffer structure (in bytes) when the buffer represents a structured buffer. For more info about structured buffers, see Structured Buffer.

The size value in StructureByteStride must match the size of the format that you use for views of the buffer. For example, if you use a shader resource view (SRV) to read a buffer in a pixel shader, the SRV format size must match the size value in StructureByteStride.

ESRAMOffsetBytes
(Xbox One; not present for Desktop.)

When you use fast ESRAM memory for the buffer, you can use this member to specify an offset in bytes. You can specify (as a request) 0-32 MB, as a multiple of 4 KB. Enhanced Static Random Access Memory (ESRAM) is 32 MB of dedicated RAM that can only be directly accessed by the GPU. See the ESRAM subsection in Resources, Buffers, and Textures, and see Implementing an ESRAM Memory Manager.

ESRAMUsageBytes
(Xbox One; not present for Desktop.)

When you use fast ESRAM memory for the buffer, you can use this member to specify the amount of ESRAM to use, in bytes.

When this member is set to zero, it means “use all remaining ESRAM beyond ESRAMOffsetBytes”, which amounts to (32 MB – ESRAMOffsetBytes). If ESRAMUsageBytes is set to zero and the surface doesn’t fit, the surface will use from ESRAMOffsetBytes to 32MB, and the remainder will spill.

Remarks

This structure is used by ID3D11Device::CreateBuffer to create buffer resources.

In addition to this structure, you can also use the CD3D11_BUFFER_DESC derived structure, which is defined in D3D11.h and behaves like an inherited class, to help create a buffer description.

If the bind flag is D3D11_BIND_CONSTANT_BUFFER, you must set the ByteWidth value in multiples of 16, and less than or equal to D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT.

Requirements

Header: Declared in d3d11_x.h (d3d11.h on other Windows platforms).