Table of Contents

Class Buffer.StructuredAppend

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Helper methods for creating Structured Append Buffers.

public static class Buffer.StructuredAppend
Inheritance
object
Buffer.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

device GraphicsDevice

The GraphicsDevice.

dataPointer DataPointer

The data pointer to the data to initialize the Structured Append Buffer.

elementSize int

The size in bytes of each element (the structure).

Returns

Buffer

A new instance of Buffer.

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

device GraphicsDevice

The GraphicsDevice.

elementCount int

The number of elements in the Buffer.

elementSize int

The size in bytes of each element (the structure).

Returns

Buffer

A new instance of Buffer.

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

device GraphicsDevice

The GraphicsDevice.

data ReadOnlySpan<byte>

The data to initialize the Structured Append Buffer.

elementSize int

The size in bytes of each element (the structure).

Returns

Buffer

A new instance of Buffer.

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

device GraphicsDevice

The GraphicsDevice.

elementCount int

The number of elements in the Buffer.

Returns

Buffer<T>

A new instance of Buffer.

Type Parameters

T

Type 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

device GraphicsDevice

The GraphicsDevice.

data T[]

The data to initialize the Structured Append Buffer.

Returns

Buffer<T>

A new instance of Buffer.

Type Parameters

T

Type of the data stored in the Buffer.

See Also