Class Buffer.Constant
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
GraphicsDeviceThe GraphicsDevice.
value
DataPointerThe value to initialize the constant buffer.
usage
GraphicsResourceUsageThe 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
GraphicsDeviceThe GraphicsDevice.
size
intThe size in bytes.
usage
GraphicsResourceUsageThe 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
GraphicsDeviceThe GraphicsDevice.
value
ReadOnlySpan<byte>The value to initialize the constant buffer.
usage
GraphicsResourceUsageThe 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
GraphicsDeviceThe 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
GraphicsDeviceThe GraphicsDevice.
value
TThe value to initialize the constant buffer.
usage
GraphicsResourceUsageThe 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
GraphicsDeviceThe GraphicsDevice.
value
T[]The value to initialize the constant buffer.
usage
GraphicsResourceUsageThe usage of this resource.
Returns
- Buffer<T>
A constant buffer
Type Parameters
T
Type of the constant buffer to get the sizeof from