Version: 2022.3

ComputeBufferConstructor

切换到手册
public ComputeBuffer (int count, int stride);
public ComputeBuffer (int count, int stride, ComputeBufferType type);
public ComputeBuffer (int count, int stride, ComputeBufferType type, ComputeBufferMode usage);

参数

count 缓冲区中元素的数量。
stride Size of one element in the buffer, in bytes. Must be a multiple of 4 and less than 2048, and match the size of the buffer type in the shader. See Compute Shaders for cross-platform compatibility information.
type 该缓冲区的类型,默认为 ComputeBufferType.Default(结构化缓冲区)。
usage Usage mode of the buffer, default is ComputeBufferModeImmutable.

描述

创建计算缓冲区。

不再需要时,使用 Release 来释放该缓冲区。

另请参阅:SystemInfo.supportsComputeShadersComputeShader 类、Shader.SetGlobalBufferMaterial.SetBuffer计算着色器概述。