Class Buffer.Structured
Helper methods for creating Structured Buffers.
public static class Buffer.Structured
- Inheritance
-
objectBuffer.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
deviceGraphicsDeviceThe GraphicsDevice.
dataPointerDataPointerThe data pointer to the data to initialize the Structured Buffer.
elementSizeintThe size in bytes of each element (the structure).
unorderedAccessbooltrue if the Buffer should support unordered access (
RWin SDSL).
Returns
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
deviceGraphicsDeviceThe GraphicsDevice.
elementCountintThe number of elements in the Buffer.
elementSizeintThe size in bytes of each element (the structure).
unorderedAccessbooltrue if the Buffer should support unordered access (
RWin SDSL).
Returns
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
deviceGraphicsDeviceThe GraphicsDevice.
dataReadOnlySpan<byte>The data to initialize the Structured Buffer.
elementSizeintThe size in bytes of each element (the structure).
unorderedAccessbooltrue if the Buffer should support unordered access (
RWin SDSL).
Returns
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
deviceGraphicsDeviceThe GraphicsDevice.
elementCountintThe number of elements in the Buffer.
unorderedAccessbooltrue if the Buffer should support unordered access (
RWin SDSL).
Returns
Type Parameters
TType 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
deviceGraphicsDeviceThe GraphicsDevice.
dataT[]The data to initialize the Structured Buffer.
unorderedAccessbooltrue if the Buffer should support unordered access (
RWin SDSL).
Returns
Type Parameters
TType of the Structured buffer to get the sizeof from