main
{
int l_Int = g_Ints[0]; // Ok
l_Int = g_Ints[1]; // Not Ok. Generates link error: “internal error: inconsistent location assignment for uniform g_Ints[1]”
vec2 l_Vec = g_Vecs[4];// Ok!
}
So I can not index uniform arrays of standard types beyond the first element, but I can for vec arrays?!
I tried with floats and booleans, the same result.
This doesn’t make sense to me.
Ok, some further investigation unveiled the real problem:
#define INDEX 1
uniform int g_Ints[8];
main
{
int l_Int = g_Ints[0]; // Ok
int l_Int = g_Ints[1]; // Not Ok. Generates link error: “internal error: inconsistent location assignment for uniform g_Ints[1]”
int l_Int = g_Ints[INDEX]; // Not Ok. Generates link error: “internal error: inconsistent location assignment for uniform g_Ints[1]”
int l_Index = 1;
int l_Int = g_Ints[l_Index]; // Not Ok. Generates link error: “internal error: inconsistent location assignment for uniform g_Ints[1]”
Looks like a driver bug to me.
If the preprocessor/compiler produces resolvable code, a boundary check seems to be triggered that ignores the fact that the uniform is an array.