I use array parameters in shader for better performance.
For example, I declare parameters in shader:
sampler2d textures[2];
float4x4 matrics[2];
float4 transforms[2];
and set these parameters by this way:
Shader.SetGlobalTexture("textures0", xxx);
Shader.SetGlobalTexture("textures1", xxx);
Shader.SetGlobalMatrix("matrics0", xxx);
Shader.SetGlobalMatrix("matrics1", xxx);
Shader.SetGlobalVector("transforms0", xxx);
Shader.SetGlobalVector("transform1", xxx);
for float4x4 and float4, they are both work fine. However, when I use texture array in shader, there is a compile error:
“sampler array index must be a literal expression”
How to deal with that?