Talk:Uniform (GLSL)
Regarding the explanation of the layout on uniform variables created from a structure it seems there is a small mistake on the layout value for the second example, shouldn't it be 7 instead of 2 for manyStructs[0].thirdField ? (0*3 [array] + 2 [struct offset] + 5 [base location]) Here is the corresponding part of the page :
struct MyStruct
{
vec2 firstField;
vec4 secondField;
mat2 thirdField;
};
layout(location = 5) uniform MyStruct manyStructs[3];
"manyStructs[0].firstField" will have the location 5. "manyStructs[0].thirdField will have the location 2. "manyStructs[2].secondField" will have the location (2*3 [array] + 1 [struct offset] + 5 [base location]), or 12. And so forth.