XG_BUFFER_DESC Structure

Describes a buffer resource.

Syntax

struct XG_BUFFER_DESC {
    UINT ByteWidth;
    XG_USAGE Usage;
    UINT BindFlags;
    UINT CPUAccessFlags;
    UINT MiscFlags;
    UINT StructureByteStride;
    UINT ESRAMOffsetBytes;
    UINT ESRAMUsageBytes;
};  

Members

ByteWidth
Size of the buffer in bytes.

Usage
Identifies 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 XG_USAGE_DEFAULT; see XG_USAGE for all possible values.

BindFlags
Flags that identify how the buffer will be bound to the pipeline. A logically OR’d combination of XG_BIND_FLAG enumeration constants.

CPUAccessFlags
CPU access flags, or 0 if no CPU access is necessary. A logically OR’d combination of XG_CPU_ACCESS_FLAG enumeration constants.

MiscFlags
Miscellaneous flags, or 0 if unused. A logically OR’d combination of XG_RESOURCE_MISC_FLAG enumeration constants.

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

XG_BUFFER_DESC is equivalent to D3D11_BUFFER_DESC.

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 xg.h.

Library: Use xg_x.lib.