class in UnityEngine

Cambiar al Manual


Data buffer to hold data for compute shaders.

ComputeShader programs often need arbitrary data to be read & written into memory buffers. ComputeBuffer class is exactly for that - you can create & fill them from script code, and use them in compute shaders or regular shaders.

Compute shaders need a fairly modern GPU (with shader model 5.0 support) and are at the moment available on DirectX 11, PS4, XboxOne and OpenGL ES 3.1. On shader side, ComputeBuffers map to StructuredBuffer<T> and RWStructuredBuffer<T> in HLSL.

See Also: SystemInfo.supportsComputeShaders, ComputeShader class, Shader.SetGlobalBuffer, Material.SetBuffer, Compute Shaders.


countNumber of elements in the buffer (Read Only).
strideSize of one element in the buffer (Read Only).


ComputeBufferCreate a Compute Buffer.

Funciones Públicas

GetDataRead data values from the buffer into an array.
GetNativeBufferPtrRetrieve a native (underlying graphics API) pointer to the buffer.
ReleaseRelease a Compute Buffer.
SetCounterValueSets counter value of append/consume buffer.
SetDataSet the buffer with values from an array.

Funciones Estáticas

CopyCountCopy counter value of append/consume buffer into another buffer.