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

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

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

Update buffer data from managed array.

Parameters

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

Update buffer data from NativeArray.

Parameters

Name Type
name System.String
data Unity.Collections.NativeArray{{T}}
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
public void ReleaseBuffer(string name)

Release a specific buffer.

Parameters

Name Type
name System.String
public void ReleaseAll()

Release all buffers.

public ComputeBuffer GetBarBuffer(int count)

Create buffer for bar chart instances.

Parameters

Name Type
count System.Int32

Returns

UnityEngine.ComputeBuffer

public ComputeBuffer GetLineBuffer(int count)

Create buffer for line chart points.

Parameters

Name Type
count System.Int32

Returns

UnityEngine.ComputeBuffer

public ComputeBuffer GetPointBuffer(int count)

Create buffer for point/scatter data.

Parameters

Name Type
count System.Int32

Returns

UnityEngine.ComputeBuffer

public ComputeBuffer GetSectorBuffer(int count)

Create buffer for pie/donut sectors.

Parameters

Name Type
count System.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