Class Buffer.Argument
Helper methods for creating Argument Buffers.
public static class Buffer.Argument
- Inheritance
-
objectBuffer.Argument
Remarks
An Argument Buffer is a Buffer that is used to pass arguments / parameters to shaders or in indirect rendering (i.e. GPU-driven rendering). The key differences with Constant Buffers is that Argument Buffer are (by default) writable by the GPU, can have an arbitrary size, and have somewhat slower access than Constant Buffers (as they are more akin to regular Buffers).
Methods
New(GraphicsDevice, int, GraphicsResourceUsage)
Creates a new Argument Buffer of a given size.
public static Buffer New(GraphicsDevice device, int bufferSize, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
bufferSizeintSize of the Buffer in bytes.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
New(GraphicsDevice, int, bool, GraphicsResourceUsage)
Creates a new Argument Buffer of a given size that compute shaders can write.
public static Buffer New(GraphicsDevice device, int bufferSize, bool unorderedAccess, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
bufferSizeintSize of the Buffer in bytes.
unorderedAccessbooltrue to let shaders write the arguments, through a
RWBuffer<uint>view (Stride.Graphics.PixelFormat.R32_UInt).usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
Remarks
Transition the Buffer to IndirectArgument between the shader that writes it and the indirect call that reads it.
New<T>(GraphicsDevice, GraphicsResourceUsage)
Creates a new Argument Buffer.
public static Buffer<T> New<T>(GraphicsDevice device, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
Type Parameters
TType of the data stored in the Buffer.
New<T>(GraphicsDevice, ref readonly T, GraphicsResourceUsage)
Creates a new Argument Buffer with initial data.
public static Buffer<T> New<T>(GraphicsDevice device, ref readonly T value, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
valueTThe value to initialize the Argument Buffer.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
Type Parameters
TType of the data stored in the Buffer.
New<T>(GraphicsDevice, T[], bool, GraphicsResourceUsage)
Creates a new Argument Buffer with initial data, optionally writable by compute shaders.
public static Buffer<T> New<T>(GraphicsDevice device, T[] initialValue, bool unorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
initialValueT[]The initial arguments.
unorderedAccessbooltrue to let shaders write the arguments, through a
RWBuffer<uint>view (Stride.Graphics.PixelFormat.R32_UInt).usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
Type Parameters
TType of the data stored in the Buffer.