Table of Contents

Class Buffer.Structured

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Helper methods for creating Structured Buffers.

public static class Buffer.Structured
Inheritance
object
Buffer.Structured

Remarks

A Structured Buffer is a Buffer that can be read in shaders using a structured format. They are an array of uniformly sized structures.

An example of this kind of Buffer in SDSL would be:

StructuredBuffer<float4> sb;
RWStructuredBuffer<float4> rwsb; // For Structured Buffers supporting unordered access

Methods

New(GraphicsDevice, DataPointer, int, bool)

Creates a new Structured 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, bool unorderedAccess = false)

Parameters

device GraphicsDevice

The GraphicsDevice.

dataPointer DataPointer

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

elementSize int

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

unorderedAccess bool

true if the Buffer should support unordered access (RW in SDSL).

Returns

Buffer

A new instance of Buffer.

New(GraphicsDevice, int, int, bool)

Creates a new Structured Buffer of a given size.

public static Buffer New(GraphicsDevice device, int elementCount, int elementSize, bool unorderedAccess = false)

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

unorderedAccess bool

true if the Buffer should support unordered access (RW in SDSL).

Returns

Buffer

A new instance of Buffer.

New(GraphicsDevice, ReadOnlySpan<byte>, int, bool)

Creates a new Structured Buffer with initial data.

public static Buffer New(GraphicsDevice device, ReadOnlySpan<byte> data, int elementSize, bool unorderedAccess = false)

Parameters

device GraphicsDevice

The GraphicsDevice.

data ReadOnlySpan<byte>

The data to initialize the Structured Buffer.

elementSize int

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

unorderedAccess bool

true if the Buffer should support unordered access (RW in SDSL).

Returns

Buffer

A new instance of Buffer.

New<T>(GraphicsDevice, int, bool)

Creates a new Structured Buffer of a given size.

public static Buffer<T> New<T>(GraphicsDevice device, int elementCount, bool unorderedAccess = false) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

elementCount int

The number of elements in the Buffer.

unorderedAccess bool

true if the Buffer should support unordered access (RW in SDSL).

Returns

Buffer<T>

A new instance of Buffer.

Type Parameters

T

Type of the data stored in the Buffer.

New<T>(GraphicsDevice, T[], bool)

Creates a new Structured Buffer with initial data.

public static Buffer<T> New<T>(GraphicsDevice device, T[] data, bool unorderedAccess = false) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

data T[]

The data to initialize the Structured Buffer.

unorderedAccess bool

true if the Buffer should support unordered access (RW in SDSL).

Returns

Buffer<T>

A new instance of Buffer.

Type Parameters

T

Type of the Structured buffer to get the sizeof from

See Also