Version: 2020.2
public void SetInts (string name, params int[] values);
public void SetInts (int nameID, params int[] values);

参数

name 该着色器代码中的数组变量名称。
nameID 属性名称 ID,使用 Shader.PropertyToID 获取。
values 要设置的值数组。

描述

一次性设置多个连续整数参数。

This function can be used to set int vector, int array or int vector array values. For example, int4 myArray[4] in the compute shader can be filled by passing 16 integers. See Compute Shaders for information on data layout rules and cross-platform compatibility.

This API feeds raw data to the constant buffer, so the provided data must follow the HLSL constant buffer data layout rules. This means that the the array elements must be aligned on float4; for example, float4 data requires no padding, float3 data needs one float padding for each element, float2 data needs two floats, and so on.

在一个计算着色器资源中,常量缓冲区在所有内核之间共享。因此,此函数会影响该 ComputeShader 中的所有内核。

另请参阅:SetFloatSetFloatsSetIntSetBoolSetBufferSetMatrixSetMatrixArraySetTextureSetVectorSetVectorArray