Version: 2021.3

CommandBuffer.SetComputeTextureParam

切换到手册
public void SetComputeTextureParam (ComputeShader computeShader, int kernelIndex, string name, Rendering.RenderTargetIdentifier rt);
public void SetComputeTextureParam (ComputeShader computeShader, int kernelIndex, int nameID, Rendering.RenderTargetIdentifier rt);
public void SetComputeTextureParam (ComputeShader computeShader, int kernelIndex, string name, Rendering.RenderTargetIdentifier rt, int mipLevel);
public void SetComputeTextureParam (ComputeShader computeShader, int kernelIndex, int nameID, Rendering.RenderTargetIdentifier rt, int mipLevel);
public void SetComputeTextureParam (ComputeShader computeShader, int kernelIndex, string name, Rendering.RenderTargetIdentifier rt, int mipLevel, Rendering.RenderTextureSubElement element);
public void SetComputeTextureParam (ComputeShader computeShader, int kernelIndex, int nameID, Rendering.RenderTargetIdentifier rt, int mipLevel, Rendering.RenderTextureSubElement element);

参数

computeShader 要为其设置参数的 ComputeShader
kernelIndex 当前为其设置纹理的内核。请参阅 ComputeShader.FindKernel
name 着色器代码中的纹理变量的名称。
nameID 属性名称 ID。使用 Shader.PropertyToID 可获取此 ID。
rt 有关要设置的纹理值或标识符,请参阅 RenderTargetIdentifier
mipLevel 读写纹理的可选 Mipmap 级别。
element Optional parameter that specifies the type of data to set from the RenderTexture.

描述

添加用于在 ComputeShader 中设置纹理参数的命令。

纹理和缓冲区按内核进行设置。可使用 ComputeShader.FindKernel 按函数名称查找内核索引。 请注意,除非着色器指定了读写(无序访问)纹理,否则将忽略 mipLevel 参数。

By specifying a `RenderTextureSubElement`, you can indicate which type of data to set from the RenderTexture. The possible options are: RenderTextureSubElement.Color, RenderTextureSubElement.Depth, and RenderTextureSubElement.Stencil.

另请参阅:DispatchComputeSetComputeFloatParamSetComputeFloatParamsSetComputeIntParamSetComputeIntParamsSetComputeMatrixParamSetComputeMatrixArrayParamSetComputeVectorParamSetComputeVectorArrayParamSetComputeBufferParamRenderTextureSubElement