Table of Contents

Class Buffer.Constant

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Constant buffer helper methods.

public static class Buffer.Constant
Inheritance
Buffer.Constant

Methods

New(GraphicsDevice, DataPointer, GraphicsResourceUsage)

Creates a new constant buffer with Dynamic usage.

[Obsolete("Use span instead")]
public static Buffer New(GraphicsDevice device, DataPointer value, GraphicsResourceUsage usage = GraphicsResourceUsage.Dynamic)

Parameters

device GraphicsDevice

The GraphicsDevice.

value DataPointer

The value to initialize the constant buffer.

usage GraphicsResourceUsage

The usage of this resource.

Returns

Buffer

A constant buffer

New(GraphicsDevice, int, GraphicsResourceUsage)

Creates a new constant buffer with a default Dynamic usage.

public static Buffer New(GraphicsDevice device, int size, GraphicsResourceUsage usage = GraphicsResourceUsage.Dynamic)

Parameters

device GraphicsDevice

The GraphicsDevice.

size int

The size in bytes.

usage GraphicsResourceUsage

The usage.

Returns

Buffer

A constant buffer

New(GraphicsDevice, ReadOnlySpan<byte>, GraphicsResourceUsage)

Creates a new constant buffer with Dynamic usage.

public static Buffer New(GraphicsDevice device, ReadOnlySpan<byte> value, GraphicsResourceUsage usage = GraphicsResourceUsage.Dynamic)

Parameters

device GraphicsDevice

The GraphicsDevice.

value ReadOnlySpan<byte>

The value to initialize the constant buffer.

usage GraphicsResourceUsage

The usage of this resource.

Returns

Buffer

A constant buffer

New<T>(GraphicsDevice)

Creates a new constant buffer with Dynamic usage.

public static Buffer<T> New<T>(GraphicsDevice device) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

Returns

Buffer<T>

A constant buffer

Type Parameters

T

Type of the constant buffer to get the sizeof from

New<T>(GraphicsDevice, ref T, GraphicsResourceUsage)

Creates a new constant buffer with Dynamic usage.

public static Buffer<T> New<T>(GraphicsDevice device, ref T value, GraphicsResourceUsage usage = GraphicsResourceUsage.Dynamic) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

value T

The value to initialize the constant buffer.

usage GraphicsResourceUsage

The usage of this resource.

Returns

Buffer<T>

A constant buffer

Type Parameters

T

Type of the constant buffer to get the sizeof from

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

Creates a new constant buffer with Dynamic usage.

public static Buffer<T> New<T>(GraphicsDevice device, T[] value, GraphicsResourceUsage usage = GraphicsResourceUsage.Dynamic) where T : unmanaged

Parameters

device GraphicsDevice

The GraphicsDevice.

value T[]

The value to initialize the constant buffer.

usage GraphicsResourceUsage

The usage of this resource.

Returns

Buffer<T>

A constant buffer

Type Parameters

T

Type of the constant buffer to get the sizeof from