StructuredBuffer
class StructuredBuffer
Description
StructuredBuffer represent a shader uniform/constant buffer values in array.
Structured buffer is human-readable representation of raw shader buffer array data that stored in GPU. This class should be using only for creating a CPU buffer (here in C#) with all shaders variables, and send it to GPU when rendering is happen, or for setup shader buffers.
In memory StructuredBuffer looks something like this: [float, float, int, int, int, Matrix4 ..., ..., ...
]. Where for example first two floats
can represent a Vector2f, or middle three ints
can represent a position or any other Vector3f.
At the moment, this API has a number of limitations, one of them is that we cannot send a certain part of the buffer, but only completely.
Constructors
StructuredBuffer
Construct new StructuredBuffer from array of values
.
StructuredBuffer
Construct new StructuredBuffer from System.IList
collection.
Methods
Set
Send the StructuredBuffer to shader to GPU. All Set the object value at end of the buffer.
Get(int index)
Gets the object value by index
from this StructuredBuffer.
Get
Gets the all
elements in sequence array of data.
Clear
Removes
all values from this StructuredBuffer (on CPU side not GPU).
CountOfElements
Returns total count
of all elements in this StructuredBuffer.
Count
Returns count
of all objects in this StructuredBuffer that was initially passed.
Size
Returns the total size
in bytes of this StructuredBuffer.
Operators
operator object[]
Convert StructuredBuffer to array of raw elements.
See Also
Last updated