Graphics Reference
In-Depth Information
Types of buffer resources include:
F
Vertex buffer
F
Index buffer
F
Constant buffer
F
Unordered access buffers
Byte address buffer
Structured buffer
Read/Write buffers
Append/Consume structured buffers
All buffers are represented by the
SharpDX.Direct3D11.Buffer
class (
ID3D11Buffer
for the unmanaged API). The usage is defined by how and where it is bound to the pipeline.
The following table shows the binding flags for different buffers:
Buffer type
Managed BindFlags flags
Unmanaged D3D11_BIND_FLAG flags
Vertex buffer
VertexBuffer
D3D11_BIND_VERTEX_BUFFER
Index buffer
IndexBuffer
D3D11_BIND_INDEX_BUFFER
Constant buffer
ConstantBuffer
D3D11_BIND_CONSTANT_BUFFER
Unordered access
buffers
UnorderedAccess
D3D11_BIND_UNORDERED_ACCESS
Unordered access buffers are further categorized into the following types using an additional
option/miscellaneous flag within the buffer description as shown in the following table:
Buffer type
Managed
ResourceOptionFlags flags
Unmanaged D3D11_RESOURCE_
MISC_FLAG flags
Byte address buffer
BufferAllowRawViews
D3D11_RESOURCE_MISC_BUFFER_
ALLOW_RAW_VIEWS
Structured buffer
BufferStructured
D3D11_RESOURCE_MISC_BUFFER_
STRUCTURED
Read/Write buffers
Either use Byte address buffer / Structured buffer and then use
RWBuffer
or
RWStructuredBuffer<MyStruct>
instead of
Buffer
and
StructuredBuffer<MyStruct>
in HLSL.
Append/Consume
buffers
A structured buffer and then use
AppendStructuredBuffer
or
ConsumeStructuredBuffer
in HLSL. Use
UnorderedAccessViewBufferFlags.Append
when
creating the UAV.