Table of Contents

Class Buffer.Typed

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Helper methods for creating Typed Buffers.

public static class Buffer.Typed
Inheritance
object
Buffer.Typed

Remarks

A Typed Buffer is a Buffer that is accessed through a Shader Resource View with a specific format. Because of this, they are created with that specific format.

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

Buffer<float4> tb;

Methods

New(GraphicsDevice, DataPointer, PixelFormat, bool, GraphicsResourceUsage)

Creates a new Typed Buffer with initial data.

[Obsolete("This method is obsolete. Use the span-based methods instead")]
public static Buffer New(GraphicsDevice device, DataPointer dataPointer, PixelFormat elementFormat, bool unorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)

Parameters

device GraphicsDevice

The GraphicsDevice.

dataPointer DataPointer

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

elementFormat PixelFormat

The format of the typed elements in the Buffer.

unorderedAccess bool

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

usage GraphicsResourceUsage

The usage for the Buffer, which determines who can read/write data. By default, it is Default.

Returns

Buffer

A new instance of Buffer.

New(GraphicsDevice, int, PixelFormat, bool, GraphicsResourceUsage)

Creates a new Typed Buffer of a given size.

public static Buffer New(GraphicsDevice device, int elementCount, PixelFormat elementFormat, bool unorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)

Parameters

device GraphicsDevice

The GraphicsDevice.

elementCount int

The number of data with the following viewFormat.

elementFormat PixelFormat

The format of the typed elements in the Buffer.

unorderedAccess bool

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

usage GraphicsResourceUsage

The usage for the Buffer, which determines who can read/write data. By default, it is Default.

Returns

Buffer

A new instance of Buffer.

New<T>(GraphicsDevice, ReadOnlySpan<T>, PixelFormat, bool, GraphicsResourceUsage)

Creates a new Typed Buffer with initial data.

public static Buffer<T> New<T>(GraphicsDevice device, ReadOnlySpan<T> data, PixelFormat elementFormat, bool unorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

data ReadOnlySpan<T>

The data to initialize the Typed Buffer.

elementFormat PixelFormat

The format of the typed elements in the Buffer.

unorderedAccess bool

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

usage GraphicsResourceUsage

The usage for the Buffer, which determines who can read/write data. By default, it is Default.

Returns

Buffer<T>

A new instance of Buffer.

Type Parameters

T

Type of the data stored in the Buffer.

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

Creates a new Typed Buffer with initial data.

public static Buffer<T> New<T>(GraphicsDevice device, T[] data, PixelFormat elementFormat, bool unorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

data T[]

The data to initialize the Typed Buffer.

elementFormat PixelFormat

The format of the typed elements in the Buffer.

unorderedAccess bool

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

usage GraphicsResourceUsage

The usage for the Buffer, which determines who can read/write data. By default, it is Default.

Returns

Buffer<T>

A new instance of Buffer.

Type Parameters

T

Type of the data stored in the Buffer.

See Also