Skip to content

ComputeBufferManager

ClassChartGuruChartGuru
public class ComputeBufferManager

ComputeBuffer management for GPU data upload. Buffer lifecycle, resizing, and data updates.

public ComputeBufferManager()

public ComputeBuffer GetBuffer(string name, int count, int stride)

Get or create a buffer with the specified name and size.

Parameters

NameTypeDescription
nameSystem.StringUnique buffer name.
countSystem.Int32Number of elements.
strideSystem.Int32Size of each element in bytes.

Returns

UnityEngine.ComputeBuffer

public void SetData<T>(string name, T[] data) where T : struct

Update buffer data from managed array.

Parameters

NameType
nameSystem.String
data{T}[]
public void SetData<T>(string name, NativeArray<T> data) where T : struct

Update buffer data from NativeArray.

Parameters

NameType
nameSystem.String
dataUnity.Collections.NativeArray{{T}}
public void BindToMaterial(string bufferName, Material material, string shaderProperty)

Bind buffer to material.

Parameters

NameType
bufferNameSystem.String
materialUnityEngine.Material
shaderPropertySystem.String
public void ReleaseBuffer(string name)

Release a specific buffer.

Parameters

NameType
nameSystem.String
public void ReleaseAll()

Release all buffers.

public ComputeBuffer GetBarBuffer(int count)

Create buffer for bar chart instances.

Parameters

NameType
countSystem.Int32

Returns

UnityEngine.ComputeBuffer

public ComputeBuffer GetLineBuffer(int count)

Create buffer for line chart points.

Parameters

NameType
countSystem.Int32

Returns

UnityEngine.ComputeBuffer

public ComputeBuffer GetPointBuffer(int count)

Create buffer for point/scatter data.

Parameters

NameType
countSystem.Int32

Returns

UnityEngine.ComputeBuffer

public ComputeBuffer GetSectorBuffer(int count)

Create buffer for pie/donut sectors.

Parameters

NameType
countSystem.Int32

Returns

UnityEngine.ComputeBuffer

public void Dispose()

Releases resources owned by this Compute Buffer Manager; callers should not use the instance afterward.

public bool SupportsCompute { get; }

Returns

System.Boolean