Class StorageBuffer
Namespace: ValveResourceFormat.Renderer.Buffers
Assembly: Renderer.dll
Shader storage buffer object for large read-write data arrays on the GPU.
public class StorageBuffer : BufferInheritance
object ← Buffer ← StorageBuffer
Inherited Members
Buffer.Target, Buffer.Handle, Buffer.BindingPoint, Buffer.Name, Buffer.Size, Buffer.BindBufferBase(), Buffer.SetBlockBinding(Shader), Buffer.Delete()
Constructors
StorageBuffer(ReservedBufferSlots)
Initializes a new storage buffer bound to the given reserved slot.
public StorageBuffer(ReservedBufferSlots bindingPoint)Parameters
bindingPoint ReservedBufferSlots
Methods
Allocate<T>(ReservedBufferSlots, int, BufferUsageHint)
Allocates a new storage buffer sized for the given number of elements.
public static StorageBuffer Allocate<T>(ReservedBufferSlots bindingPoint, int elements, BufferUsageHint usage)Parameters
bindingPoint ReservedBufferSlots
The reserved slot to bind the buffer to.
elements int
Number of elements to allocate space for.
usage BufferUsageHint
The intended usage hint for the buffer.
Returns
The newly allocated .
Type Parameters
T
The element type used to compute the total byte size.
Remarks
BufferUsageHint.DynamicRead creates a mapped buffer
Clear()
Zeroes the entire contents of this buffer.
public void Clear()Create<T>(List<T>)
Uploads the contents of a list to this buffer, replacing any existing data.
public void Create<T>(List<T> data) where T : structParameters
data List<T>
Type Parameters
T
Create<T>(T[], int)
Uploads a typed array to this buffer with the given total byte size.
public void Create<T>(T[] data, int totalSizeInBytes) where T : structParameters
data T[]
The source array to upload.
totalSizeInBytes int
Total number of bytes to upload from data.
Type Parameters
T
Create<T>(ReadOnlySpan<T>, BufferUsageHint)
Uploads a read-only span to this buffer using the specified usage hint.
public void Create<T>(ReadOnlySpan<T> data, BufferUsageHint usageHint) where T : structParameters
data ReadOnlySpan<T>
The source span to upload.
usageHint BufferUsageHint
The intended usage pattern for the buffer.
Type Parameters
T
Delete()
Deletes the underlying OpenGL buffer object.
public override void Delete()Read<T>(ref T)
Reads the buffer's contents back from the GPU into the given struct.
public void Read<T>(ref T output) where T : structParameters
output T
The struct to populate with buffer data.
Type Parameters
T
Update<T>(T[], int, int)
Updates a region of this buffer with new data, allocating it first if empty.
public void Update<T>(T[] data, int offset, int size) where T : structParameters
data T[]
The source array containing new data.
offset int
Byte offset into the buffer at which to begin writing.
size int
Number of bytes to write.
Type Parameters
T

