Merge pull request #2976 from jeremy-lunarg/hayes-fix-2975
[platform/upstream/glslang.git] / Test / 300layout.vert
1 #version 300 es
2
3 struct s { vec4 v; };
4
5 layout(location = 7) in vec3 c;
6 layout(LocatioN = 3) in vec4 p;
7 layout(LocatioN = 9) in vec4 q[4]; // ERROR, no array
8 layout(LocatioN = 10) in s r[4];   // ERROR, no struct, ERROR, location overlap
9 out vec4 pos;
10 out vec3 color;
11
12 layout(shared, column_major) uniform mat4 badm4; // ERROR
13 layout(shared, column_major, row_major) uniform; // default is now shared and row_major
14
15 layout(std140) uniform Transform { // layout of this block is std140
16     mat4 M1; // row_major
17     layout(column_major) mat4 M2; // column major
18     mat3 N1; // row_major
19     centroid float badf;  // ERROR
20     in float badg;        // ERROR
21     layout(std140) float bad1;
22     layout(shared) float bad2;
23     layout(packed) float bad3;
24 } tblock;
25
26 uniform T2 { // layout of this block is shared
27     bool b;
28     mat4 t2m;
29 };
30
31 layout(column_major) uniform T3 { // shared and column_major
32     mat4 M3; // column_major
33     layout(row_major) mat4 M4; // row major
34     mat3 N2; // column_major
35     int b;  // ERROR, redefinition (needs to be last member of block for testing, following members are skipped)
36 };
37
38 out badout {  // ERROR
39     float f;
40 };
41
42 layout (location = 10) out vec4 badoutA;  // ERROR
43
44 void main()
45 {
46     pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m);
47     color = c * tblock.N1;
48 }
49
50 shared vec4 compute_only;  // ERROR
51
52 layout(packed) uniform;
53
54 layout(packed) uniform float aoeuntaoeu;  // ERROR, packed on variable
55
56 layout(location = 40) in float cd;
57 layout(location = 37) in mat4x3 ce; // ERROR, overlap