ComputeBufferManager
public class ComputeBufferManagerComputeBuffer management for GPU data upload. Buffer lifecycle, resizing, and data updates.
Constructors
Section titled “Constructors”
ComputeBufferManager()
Section titled “ComputeBufferManager()”public ComputeBufferManager()Methods
Section titled “Methods”
GetBuffer(string, int, int)
Section titled “GetBuffer(string, int, int)”public ComputeBuffer GetBuffer(string name, int count, int stride)Get or create a buffer with the specified name and size.
Parameters
| Name | Type | Description |
|---|---|---|
name |
System.String | Unique buffer name. |
count |
System.Int32 | Number of elements. |
stride |
System.Int32 | Size of each element in bytes. |
Returns
UnityEngine.ComputeBuffer
SetData(string, T[])
Section titled “SetData(string, T[])”public void SetData<T>(string name, T[] data) where T : structUpdate buffer data from managed array.
Parameters
| Name | Type |
|---|---|
name |
System.String |
data |
{T}[] |
SetData(string, NativeArray)
Section titled “SetData(string, NativeArray)”public void SetData<T>(string name, NativeArray<T> data) where T : structUpdate buffer data from NativeArray.
Parameters
| Name | Type |
|---|---|
name |
System.String |
data |
Unity.Collections.NativeArray{{T}} |
BindToMaterial(string, Material, string)
Section titled “BindToMaterial(string, Material, string)”public void BindToMaterial(string bufferName, Material material, string shaderProperty)Bind buffer to material.
Parameters
| Name | Type |
|---|---|
bufferName |
System.String |
material |
UnityEngine.Material |
shaderProperty |
System.String |
ReleaseBuffer(string)
Section titled “ReleaseBuffer(string)”public void ReleaseBuffer(string name)Release a specific buffer.
Parameters
| Name | Type |
|---|---|
name |
System.String |
ReleaseAll()
Section titled “ReleaseAll()”public void ReleaseAll()Release all buffers.
GetBarBuffer(int)
Section titled “GetBarBuffer(int)”public ComputeBuffer GetBarBuffer(int count)Create buffer for bar chart instances.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
UnityEngine.ComputeBuffer
GetLineBuffer(int)
Section titled “GetLineBuffer(int)”public ComputeBuffer GetLineBuffer(int count)Create buffer for line chart points.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
UnityEngine.ComputeBuffer
GetPointBuffer(int)
Section titled “GetPointBuffer(int)”public ComputeBuffer GetPointBuffer(int count)Create buffer for point/scatter data.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
UnityEngine.ComputeBuffer
GetSectorBuffer(int)
Section titled “GetSectorBuffer(int)”public ComputeBuffer GetSectorBuffer(int count)Create buffer for pie/donut sectors.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
UnityEngine.ComputeBuffer
Dispose()
Section titled “Dispose()”public void Dispose()Releases resources owned by this Compute Buffer Manager; callers should not use the instance afterward.
Properties
Section titled “Properties”
SupportsCompute
Section titled “SupportsCompute”public bool SupportsCompute { get; }Returns
System.Boolean