Class CircularStructuredBuffer<T>
Represents a StructuredBuffer<T>, along with the index of the next entry to be written to.
Inherited Members
Namespace: Mechatronics.SensorSDK
Assembly: solution.dll
Syntax
public class CircularStructuredBuffer<T> where T : unmanaged
Type Parameters
Name | Description |
---|---|
T | The type of elements in the ComputeBuffer. Must be blittable. |
Remarks
Writers use WriteIndex to know where to write, and increase WriteCount after the write. To know where to read from, readers keep their own read count (never bigger than WriteCount). This way, the buffer can be read multiple times by different nodes.
Constructors
Name | Description |
---|---|
CircularStructuredBuffer(string) | Initializes and returns an instance of CircularStructuredBuffer. |
Properties
Name | Description |
---|---|
Buffer | The underlying compute buffer. Can be null if Capacity is 0 (Read Only). |
Capacity | The total number of elements in the circular buffer. Can be 0 (Read Only). |
Stride | The size in bytes of a single element (Read Only). |
WriteCount | The total number of elements that have been written to the buffer. Can be greater than Capacity. |
WriteIndex | The index to write to next in the buffer. The range is 0 through Capacity-1. |
Methods
Name | Description |
---|---|
GetAvailableCount(ref ulong) | Computes the number of elements available to read from the buffer. The range is 0 through Capacity. |
GetReadIndex(ulong) | Computes the index to read from next in the buffer. The range is 0 through Capacity-1. |
Release() | Releases the underlying ComputeBuffer and resets the write index. |
Resize(int) | Reallocates the underlying buffer if necessary. WriteCount is reset only if Capacity changes. |