Version: 2022.2

CommandBuffer.SetComputeBufferParam

切换到手册
public void SetComputeBufferParam (ComputeShader computeShader, int kernelIndex, string name, ComputeBuffer buffer);
public void SetComputeBufferParam (ComputeShader computeShader, int kernelIndex, int nameID, ComputeBuffer buffer);
public void SetComputeBufferParam (ComputeShader computeShader, int kernelIndex, string name, GraphicsBuffer buffer);
public void SetComputeBufferParam (ComputeShader computeShader, int kernelIndex, int nameID, GraphicsBuffer buffer);
public void SetComputeBufferParam (ComputeShader computeShader, int kernelIndex, int nameID, GraphicsBufferHandle bufferHandle);
public void SetComputeBufferParam (ComputeShader computeShader, int kernelIndex, string name, GraphicsBufferHandle bufferHandle);

参数

computeShader 要为其设置参数的 ComputeShader
kernelIndex 当前为其设置缓冲区的内核。请参阅 ComputeShader.FindKernel
name 着色器代码中的缓冲区变量的名称。
nameID 属性名称 ID。使用 Shader.PropertyToID 可获取此 ID。
buffer 要设置的缓冲区。
bufferHandle The handle of the buffer to set.

描述

添加用于在 ComputeShader 中设置输入或输出缓冲区参数的命令。

缓冲区和纹理按内核逐一设置。可使用 ComputeShader.FindKernel 按函数名称查找内核索引。

Setting a compute buffer to a kernel will leave the append/consume counter value unchanged. To set or reset the value, use ComputeBuffer.SetCounterValue or GraphicsBuffer.SetCounterValue.

另请参阅:DispatchComputeSetComputeFloatParamSetComputeFloatParamsSetComputeIntParamSetComputeIntParamsSetComputeMatrixParamSetComputeMatrixArrayParamSetComputeVectorParamSetComputeVectorArrayParamSetComputeTextureParam