Class Buffer.StructuredAppend
Helper methods for creating Structured Append Buffers.
public static class Buffer.StructuredAppend
- Inheritance
-
objectBuffer.StructuredAppend
Remarks
A Structured Append Buffer (also known as Append / Consume Buffer) is a Buffer that allows atomic append operations from shaders. They work like a stack: elements can be appended to the end. They are a special kind of Structured Buffers, so they are also an array of uniformly sized structures.
An example of this kind of Buffer in SLSL would be:
AppendStructuredBuffer<float4> asb;
ConsumeStructuredBuffer<float4> csb;
Methods
New(GraphicsDevice, DataPointer, int)
Creates a new Structured Append Buffer with initial data.
[Obsolete("This method is obsolete. Use the span-based methods instead")]
public static Buffer New(GraphicsDevice device, DataPointer dataPointer, int elementSize)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
dataPointerDataPointerThe data pointer to the data to initialize the Structured Append Buffer.
elementSizeintThe size in bytes of each element (the structure).
Returns
New(GraphicsDevice, int, int)
Creates a new Structured Append Buffer of a given size.
public static Buffer New(GraphicsDevice device, int elementCount, int elementSize)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
elementCountintThe number of elements in the Buffer.
elementSizeintThe size in bytes of each element (the structure).
Returns
New(GraphicsDevice, ReadOnlySpan<byte>, int)
Creates a new Structured Append Buffer with initial data.
public static Buffer New(GraphicsDevice device, ReadOnlySpan<byte> data, int elementSize)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
dataReadOnlySpan<byte>The data to initialize the Structured Append Buffer.
elementSizeintThe size in bytes of each element (the structure).
Returns
New<T>(GraphicsDevice, int)
Creates a new Structured Append Buffer of a given size.
public static Buffer<T> New<T>(GraphicsDevice device, int elementCount) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
elementCountintThe number of elements in the Buffer.
Returns
Type Parameters
TType of the data stored in the Buffer.
New<T>(GraphicsDevice, T[])
Creates a new Structured Append Buffer with initial data.
public static Buffer<T> New<T>(GraphicsDevice device, T[] data) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
dataT[]The data to initialize the Structured Append Buffer.
Returns
Type Parameters
TType of the data stored in the Buffer.