
66 IDiscovering
Variab le Vertex
attribute
locations
Varying
locations
Fragment
output
locations
vec4 v; 111
uvec3 v; 111
float s; 111
dvec2 v; 11N/A
dvec4 v; 11or2N/A
vec2 a[2]; 222
uint a[3]; 333
vec4 a[]; N/A 1 N/A
mat4x3 m; 444
dmat3x2 m; 33N/A
dmat2x3 m; 22or4N/A
struct S{
vec3 A;
float B; N/A 3 N/A
ivec2 C;
} s;
struct S{
mat3x4 A;
double B[2]; N/A 18 N/A
ivec2 C;
} a[3];
Tabl e 5 .2. Examples of variable types and their count of locations.
Tips
– An application may assume for portability that dvec3 and dvec4 each take two
locations, as there is no convenient way to know the actual requirement by a
specific implementation.
– Consider packing the components when locations ...