trying to make a shader that indexes from a table:
#ifndef GETLAYERCOLOR_INCLUDE
#define GETLAYERCOLOR_INCLUDE
uniform float4 layerColors[10] = {
float4(1, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 0, 0, 0)
};
void GetLayerColor_float(float2 UV, out float4 LayerColor)
{
LayerColor = layerColors[0];
}
#endif```
`layerColors[0]` makes the output float4 black (all zeroes) but doing `LayerColor = float4(1, 0, 0, 0)` outputs correctly; how come layerColors[0] isn't returning the element at index 0?