blob: be49822523cf2773039ef2f904b761360a2889dc [file] [log] [blame]
John Kessenich11f9fc72013-11-07 01:06:34 +00001#version 440 core
2
John Kessenich568bc3a2013-11-13 05:40:44 +00003layout(std140, row_major) uniform nameless {
John Kessenich11f9fc72013-11-07 01:06:34 +00004 vec3 anonMember1;
John Kessenich568bc3a2013-11-13 05:40:44 +00005 mat3x2 m23;
6 int scalarAfterm23;
John Kessenich11f9fc72013-11-07 01:06:34 +00007 vec4 anonDeadMember2;
8 vec4 anonMember3;
John Kessenich568bc3a2013-11-13 05:40:44 +00009 int scalarBeforeArray;
10 float floatArray[5];
11 int scalarAfterArray;
John Kessenich12f92212013-11-15 01:34:27 +000012 mat2x2 m22[9];
John Kessenich11f9fc72013-11-07 01:06:34 +000013};
14
John Kessenich568bc3a2013-11-13 05:40:44 +000015layout(std140, column_major) uniform c_nameless {
16 vec3 c_anonMember1;
17 mat3x2 c_m23;
18 int c_scalarAfterm23;
19 vec4 c_anonDeadMember2;
20 vec4 c_anonMember3;
21};
22
23layout(std140) uniform named {
John Kessenich11f9fc72013-11-07 01:06:34 +000024 vec3 deadMember1;
John Kessenich568bc3a2013-11-13 05:40:44 +000025 int scalar;
John Kessenich11f9fc72013-11-07 01:06:34 +000026 vec4 member2;
27 vec4 member3;
John Kessenich568bc3a2013-11-13 05:40:44 +000028 vec2 memvec2;
29 float memf1;
30 bool memf2;
31 int memf3;
32 vec2 memvec2a;
John Kessenich12f92212013-11-15 01:34:27 +000033 mat2x2 m22[7];
John Kessenich11f9fc72013-11-07 01:06:34 +000034} ablock;
35
John Kessenich568bc3a2013-11-13 05:40:44 +000036layout(std140) uniform namelessdead {
John Kessenich11f9fc72013-11-07 01:06:34 +000037 int a;
38};
39
John Kessenich568bc3a2013-11-13 05:40:44 +000040layout(std140) uniform namedDead {
John Kessenich11f9fc72013-11-07 01:06:34 +000041 int b;
42} bblock;
43
John Kessenich12f92212013-11-15 01:34:27 +000044struct N1 {
45 float a;
46};
47
48struct N2 {
49 float b;
50 float c;
51 float d;
52};
53
54struct N3 {
55 N1 n1;
56 N2 n2;
57};
58
59layout(std140) uniform nested {
60 N3 foo;
61} nest;
62
John Kessenich11f9fc72013-11-07 01:06:34 +000063struct TS {
64 int a;
65 int dead;
66};
67
68uniform TS s;
69
70uniform float uf1;
71uniform float uf2;
72uniform float ufDead3;
73uniform float ufDead4;
74
John Kessenichddea6782014-08-10 18:19:36 +000075uniform writeonly uimage2D image_ui2D;
John Kessenichec252df2013-11-13 19:07:43 +000076uniform sampler2D sampler_2D;
77uniform sampler2DMSArray sampler_2DMSArray;
78
John Kessenich12f92212013-11-15 01:34:27 +000079uniform mat2 dm22[10];
80
John Kessenich43e43ce2013-11-15 20:41:31 +000081struct deep1 {
82 vec2 va[3];
83 bool b;
84};
85
86struct deep2 {
87 int i;
88 deep1 d1[4];
89};
90
91struct deep3 {
92 vec4 iv4;
93 deep2 d2;
94 ivec3 v3;
95};
96
Thomas Perlbef74282016-05-19 09:26:20 +020097in float attributeFloat;
98layout(location = 2) in vec2 attributeFloat2;
99in vec3 attributeFloat3;
100in vec4 attributeFloat4;
101in mat4 attributeMat4;
102
John Kessenich43e43ce2013-11-15 20:41:31 +0000103uniform deep3 deepA[2], deepB[2], deepC[3], deepD[2];
104
John Kessenich11f9fc72013-11-07 01:06:34 +0000105const bool control = true;
106
107void deadFunction()
108{
109 vec3 v3 = ablock.deadMember1;
110 vec4 v = anonDeadMember2;
111 float f = ufDead4;
112}
113
114void liveFunction2()
115{
116 vec3 v = anonMember1;
117 float f = uf1;
118}
119
John Kessenichddea6782014-08-10 18:19:36 +0000120void liveFunction1(writeonly uimage2D p_ui2D, sampler2D p_2D, sampler2DMSArray p_2DMSArray)
John Kessenichec252df2013-11-13 19:07:43 +0000121
John Kessenich11f9fc72013-11-07 01:06:34 +0000122{
123 liveFunction2();
124 float f = uf2;
125 vec4 v = ablock.member3;
126}
127
John Kessenich04884e42013-11-21 00:54:57 +0000128uniform abl {
129 float foo;
130} arrBl[4];
131
John Kessenich5b9f9882013-11-23 00:44:18 +0000132uniform abl2 {
133 float foo;
134} arrBl2[4];
135
John Kessenich11f9fc72013-11-07 01:06:34 +0000136void main()
137{
John Kessenichec252df2013-11-13 19:07:43 +0000138 liveFunction1(image_ui2D, sampler_2D, sampler_2DMSArray);
John Kessenich11f9fc72013-11-07 01:06:34 +0000139 liveFunction2();
140
141 if (! control)
142 deadFunction();
143
144 float f;
John Kessenich12f92212013-11-15 01:34:27 +0000145 int i;
John Kessenich11f9fc72013-11-07 01:06:34 +0000146 if (control) {
147 liveFunction2();
148 f = anonMember3.z;
149 f = s.a;
John Kessenich568bc3a2013-11-13 05:40:44 +0000150 f = ablock.scalar;
151 f = m23[1].y + scalarAfterm23;
152 f = c_m23[1].y + c_scalarAfterm23;
153 f += scalarBeforeArray;
154 f += floatArray[2];
John Kessenich43e43ce2013-11-15 20:41:31 +0000155 f += floatArray[4];
John Kessenich568bc3a2013-11-13 05:40:44 +0000156 f += scalarAfterArray;
157 f += ablock.memvec2.x;
158 f += ablock.memf1;
159 f += float(ablock.memf2);
160 f += ablock.memf3;
161 f += ablock.memvec2a.y;
John Kessenich12f92212013-11-15 01:34:27 +0000162 f += ablock.m22[i][1][0];
163 f += dm22[3][0][1];
164 f += m22[2][1].y;
165 f += nest.foo.n1.a + nest.foo.n2.b + nest.foo.n2.c + nest.foo.n2.d;
John Kessenich43e43ce2013-11-15 20:41:31 +0000166 f += deepA[i].d2.d1[2].va[1].x;
167 f += deepB[1].d2.d1[i].va[1].x;
168 f += deepB[i].d2.d1[i].va[1].x;
169 deep3 d = deepC[1];
170 deep3 da[2] = deepD;
John Kessenich11f9fc72013-11-07 01:06:34 +0000171 } else
172 f = ufDead3;
John Kessenich04884e42013-11-21 00:54:57 +0000173
John Kessenich5b9f9882013-11-23 00:44:18 +0000174 f += arrBl[2].foo + arrBl[0].foo;
175 f += arrBl2[i].foo;
Thomas Perlbef74282016-05-19 09:26:20 +0200176
177 f += attributeFloat;
178 f += attributeFloat2.x;
179 f += attributeFloat3.x;
180 f += attributeFloat4.x;
181 f += attributeMat4[0][1];
John Kessenich11f9fc72013-11-07 01:06:34 +0000182}