1# -------------------------------------------------
2# drawElements Quality Program OpenGL ES 3.2 Module
3# -------------------------------------------------
4#
5# Copyright 2016 The Android Open Source Project
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11#      http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18
19
20#X1. Constructor tests test constructing arrays of arrays with different declaration syntax and data types.
21#X2. Return value tests test arrays of arrays as function return values.
22#X3. Parameter tests test arrays of arrays as different types of function parameters (in, out, unnamed).
23#X4. Implicit size tests test constructing arrays of arrays with implicit size.
24#X5. Assignment tests test assigning an array of arrays to another array of arrays variable.
25#X6. Length tests test the length method of arrays of arrays.
26#X8. Array access tests test array element access at initialization with const/dynamic values
27
28group constructor "Array of arrays constructors"
29
30	group explicit "Testing constructors with explicit sizes"
31		case float_3x3
32			version 320 es
33			desc "Testing constructing explicitly sized arrays of arrays"
34			values
35			{
36				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
37				output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
38			}
39
40			both ""
41				#version 320 es
42				precision mediump float;
43				${DECLARATIONS}
44
45				void main()
46				{
47					${SETUP}
48					float[3][3] x;
49					x = float[3][3] (	float[3] (in0.z, in0.x, in0.y),
50										float[3] (in0.z, in0.x, in0.y),
51										float[3] (in0.z, in0.x, in0.y) );
52					out0 = vec3(x[0][0], x[1][1], x[2][2]);
53					${OUTPUT}
54				}
55			""
56		end
57
58		case float_3x4
59			version 320 es
60			desc "Testing constructing explicitly sized arrays of arrays"
61			values
62			{
63				input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 0.2) | vec4(7.4, -1.0, 2.0, -1.3) | vec4(3.0, 1.6, -2.0, 0.5) ];
64				output vec4 out0 = [ vec4(2.0, 0.5, 0.2, 1.0) | vec4(2.0, 7.4, -1.3, -1.0) | vec4(-2.0, 3.0, 0.5, 1.6) ];
65			}
66
67			both ""
68				#version 320 es
69				precision mediump float;
70				${DECLARATIONS}
71
72				void main()
73				{
74					${SETUP}
75					float[3][4] x;
76					x = float[3][4] (		float[4] (in0.z, in0.x, in0.w, in0.y),
77										float[4] (in0.z, in0.x, in0.w, in0.y),
78										float[4] (in0.z, in0.x, in0.w, in0.y) );
79					out0 = vec4(x[0][0], x[1][1], x[2][2], x[2][3]);
80					${OUTPUT}
81				}
82			""
83		end
84
85		case int_3x1
86			version 320 es
87			desc "Testing constructing explicitly sized arrays of arrays"
88			values
89			{
90				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
91				output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
92			}
93
94			both ""
95				#version 320 es
96				precision mediump int;
97				precision mediump float;
98				${DECLARATIONS}
99
100				void main()
101				{
102					${SETUP}
103					int x[3][1];
104					x = int[3][1] (	int[1] (in0.z),
105									int[1] (in0.x),
106									int[1] (in0.y) );
107					out0 = ivec3(x[0][0], x[1][0], x[2][0]);
108					${OUTPUT}
109				}
110			""
111		end
112
113		case int_4x4x4
114			version 320 es
115			desc "Testing constructing explicitly sized arrays of arrays"
116			values
117			{
118				input ivec4 in0 = [ ivec4(0, 1, 2, 0) | ivec4(7, -1, 2, -1) | ivec4(3, 1, -2, 0) ];
119				output ivec4 out0 = [ ivec4(2, 0, 0, 1) | ivec4(2, 7, -1, -1) | ivec4(-2, 3, 0, 1) ];
120			}
121
122			both ""
123				#version 320 es
124				precision mediump int;
125				precision mediump float;
126				${DECLARATIONS}
127
128				void main()
129				{
130					${SETUP}
131					int[4] x[4][4];
132					x = int[4][4][4] (	int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
133													(int[4] (in0.z, in0.x, in0.w, in0.y)),
134													(int[4] (in0.z, in0.x, in0.w, in0.y)),
135													(int[4] (in0.z, in0.x, in0.w, in0.y))),
136
137										int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
138													(int[4] (in0.z, in0.x, in0.w, in0.y)),
139													(int[4] (in0.z, in0.x, in0.w, in0.y)),
140													(int[4] (in0.z, in0.x, in0.w, in0.y))),
141
142										int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
143													(int[4] (in0.z, in0.x, in0.w, in0.y)),
144													(int[4] (in0.z, in0.x, in0.w, in0.y)),
145													(int[4] (in0.z, in0.x, in0.w, in0.y))),
146
147										int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
148													(int[4] (in0.z, in0.x, in0.w, in0.y)),
149													(int[4] (in0.z, in0.x, in0.w, in0.y)),
150													(int[4] (in0.z, in0.x, in0.w, in0.y))) );
151
152					out0 = ivec4(x[0][0][0], x[1][1][1], x[2][2][2], x[3][3][3]);
153					${OUTPUT}
154				}
155			""
156		end
157
158		case bool_3x3x3
159			version 320 es
160			desc "Testing constructing explicitly sized arrays of arrays"
161			values
162			{
163				input bvec3 in0 = [ bvec3(true, true, false) ];
164				output bvec3 out0 = [ bvec3(false, true, true) ];
165			}
166
167			both ""
168				#version 320 es
169				precision mediump float;
170				${DECLARATIONS}
171
172				void main()
173				{
174					${SETUP}
175					bool[3][3][3] x;
176					x = bool[3][3][3] (	bool[3][3] ((bool[3] (in0.y, in0.y, in0.y)),
177													(bool[3] (in0.z, in0.z, in0.z)),
178													(bool[3] (in0.x, in0.x, in0.x))),
179
180										bool[3][3] ((bool[3] (in0.y, in0.y, in0.y)),
181													(bool[3] (in0.z, in0.z, in0.z)),
182													(bool[3] (in0.x, in0.x, in0.x))),
183
184										bool[3][3] ((bool[3] (in0.y, in0.y, in0.y)),
185													(bool[3] (in0.z, in0.z, in0.z)),
186													(bool[3] (in0.x, in0.x, in0.x))) );
187
188					out0 = bvec3(x[1][1][1], x[0][0][0], x[2][2][2]);
189					${OUTPUT}
190				}
191			""
192		end
193
194		case bool_2x1x4
195			version 320 es
196			desc "Testing constructing explicitly sized arrays of arrays"
197			values
198			{
199				input bvec4 in0 = [ bvec4(true, true, false, false) ];
200				output bvec4 out0 = [ bvec4(false, true, true, false) ];
201			}
202
203			both ""
204				#version 320 es
205				precision mediump float;
206				${DECLARATIONS}
207
208				void main()
209				{
210					${SETUP}
211					bool x[2][1][4];
212					x = bool[2][1][4] ( bool[1][4] ((bool[4] (in0.z, in0.x, in0.y, in0.w))),
213										bool[1][4] ((bool[4] (in0.z, in0.x, in0.y, in0.w))) );
214					out0 = bvec4(x[0][0][0], x[0][0][1], x[1][0][2], x[1][0][3]);
215					${OUTPUT}
216				}
217			""
218		end
219
220		case struct_3x2
221			version 320 es
222			desc "Testing constructing explicitly sized arrays of arrays"
223			values
224			{
225				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
226				output vec3 out0 = [ vec3(2.0, -0.5, -1.0) ];
227			}
228
229			both ""
230				#version 320 es
231				precision mediump float;
232				${DECLARATIONS}
233
234				void main()
235				{
236					${SETUP}
237
238					struct Test
239					{
240						float f;
241						vec3 v;
242					};
243
244					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
245					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
246					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
247
248					Test[2] x[3] = Test[3][2] ( (Test[2] (a, b)),
249												(Test[2] (c, a)),
250											    (Test[2] (b, c)) );
251
252					out0 = vec3(x[0][0].f, x[0][1].v.y, x[2][1].v.x);
253					${OUTPUT}
254				}
255			""
256		end
257
258		case struct_4x1x4
259			version 320 es
260			desc "Testing constructing explicitly sized arrays of arrays"
261			values
262			{
263				input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 1.5) ];
264				output vec4 out0 = [ vec4(2.0, -0.5, -1.0, -1.5) ];
265			}
266
267			both ""
268				#version 320 es
269				precision mediump float;
270				${DECLARATIONS}
271
272				void main()
273				{
274					${SETUP}
275
276					struct Test
277					{
278						float f;
279						vec3 v;
280					};
281
282					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
283					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
284					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
285					Test d = Test(-in0.w, vec3(-in0.w, -in0.x, -in0.z));
286
287					Test[4] x[4][1] = Test[4][1][4] (	(Test[1][4] (Test[4] (a, b, c, d))),
288														(Test[1][4] (Test[4] (a, b, c, d))),
289														(Test[1][4] (Test[4] (a, b, c, d))),
290														(Test[1][4] (Test[4] (a, b, c, d))) );
291
292					out0 = vec4(x[0][0][0].f, x[1][0][1].v.y, x[2][0][2].v.x, x[3][0][3].v.x);
293					${OUTPUT}
294				}
295			""
296		end
297
298		case vec3_4x3
299			version 320 es
300			desc "Testing constructing explicitly sized arrays of arrays"
301			values
302			{
303				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
304				output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(7.4, -2.0, -1.0) | vec3(3.0, 2.0, 1.6) ];
305			}
306
307			both ""
308				#version 320 es
309				precision mediump float;
310				${DECLARATIONS}
311
312				void main()
313				{
314					${SETUP}
315
316					vec3[3] x[4];
317					x = vec3[4][3] (vec3[3] (	vec3(in0.x, in0.y, in0.z),
318												vec3(-in0.y, -in0.z, -in0.x),
319												vec3(in0.z, in0.x, in0.y)),
320									vec3[3] (	vec3(in0.x, in0.y, in0.z),
321												vec3(-in0.y, -in0.z, -in0.x),
322												vec3(in0.z, in0.x, in0.y)),
323									vec3[3] (	vec3(in0.x, in0.y, in0.z),
324												vec3(-in0.y, -in0.z, -in0.x),
325												vec3(in0.z, in0.x, in0.y)),
326									vec3[3] (	vec3(in0.x, in0.y, in0.z),
327												vec3(-in0.y, -in0.z, -in0.x),
328												vec3(in0.z, in0.x, in0.y)) );
329
330					out0 = vec3(x[0][0].x, x[1][1].y, x[3][2].z);
331					${OUTPUT}
332				}
333			""
334		end
335
336		case ivec3_3x2x1
337			version 320 es
338			desc "Testing constructing explicitly sized arrays of arrays"
339			values
340			{
341				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
342				output ivec3 out0 = [ ivec3(5, -2, 1) | ivec3(7, -2, -1) | ivec3(3, 2, 1) ];
343			}
344
345			both ""
346				#version 320 es
347				precision mediump int;
348				precision mediump float;
349				${DECLARATIONS}
350
351				void main()
352				{
353					${SETUP}
354
355					ivec3 x[3][2][1];
356					x = ivec3[3][2][1] (ivec3[2][1] (	ivec3[1] (ivec3(in0.x, in0.y, in0.z)),
357														ivec3[1] (ivec3(-in0.y, -in0.z, -in0.x))),
358										ivec3[2][1] (	ivec3[1] (ivec3(in0.z, in0.x, in0.y)),
359														ivec3[1] (ivec3(in0.x, in0.y, in0.z))),
360										ivec3[2][1] (	ivec3[1] (ivec3(-in0.y, -in0.z, -in0.x)),
361														ivec3[1] (ivec3(in0.z, in0.x, in0.y))) );
362
363					out0 = ivec3(x[0][0][0].x, x[2][0][0].y, x[1][0][0].z);
364					${OUTPUT}
365				}
366			""
367		end
368
369		case bvec3_1x2x3
370			version 320 es
371			desc "Testing constructing explicitly sized arrays of arrays"
372			values
373			{
374				input bvec3 in0 = [ bvec3(true, false, true) ];
375				output bvec3 out0 = [ bvec3(true, true, false) ];
376			}
377
378			both ""
379				#version 320 es
380				precision mediump float;
381				${DECLARATIONS}
382
383				void main()
384				{
385					${SETUP}
386
387					bvec3[3] x[1][2];
388					x = bvec3[1][2][3] ( bvec3[2][3] (	bvec3[3] (	bvec3(in0.x, in0.y, in0.z),
389																	bvec3(in0.y, in0.z, in0.x),
390																	bvec3(in0.z, in0.x, in0.y)),
391
392														bvec3[3] (	bvec3(in0.z, in0.x, in0.y),
393																	bvec3(in0.x, in0.y, in0.z),
394																	bvec3(in0.y, in0.z, in0.x)) ));
395
396					out0 = bvec3(x[0][0][0].x, x[0][0][1].y, x[0][1][0].z);
397					${OUTPUT}
398				}
399			""
400		end
401
402		case mat3_3x2
403			version 320 es
404			desc "Testing constructing explicitly sized arrays of arrays"
405			values
406			{
407				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
408				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
409			}
410
411			both ""
412				#version 320 es
413				precision mediump float;
414				${DECLARATIONS}
415
416				void main()
417				{
418					${SETUP}
419					mat3[3][2] a = mat3[3][2] (	mat3[2] (	mat3(	in0.x, in0.y, in0.z,
420																	in0.x, in0.y, in0.z,
421																	in0.x, in0.y, in0.z),
422															mat3(	in0.z, in0.x, -in0.y,
423																	in0.z, in0.x, -in0.y,
424																	in0.z, in0.x, -in0.y)),
425
426												mat3[2] (	mat3(	-in0.z, -in0.z, in0.z,
427																	-in0.y, -in0.y, in0.y,
428																	-in0.x, -in0.x, in0.x),
429															mat3(	in0.x, in0.y, in0.z,
430																	in0.x, in0.y, in0.z,
431																	in0.x, in0.y, in0.z)),
432
433												mat3[2] (	mat3(	in0.z, in0.x, -in0.y,
434																	in0.z, in0.x, -in0.y,
435																	in0.z, in0.x, -in0.y),
436															mat3(	-in0.z, -in0.z, in0.z,
437																	-in0.y, -in0.y, in0.y,
438																	-in0.x, -in0.x, in0.x)) );
439
440					mat3 a0 = a[0][0];
441					mat3 a1 = a[0][1];
442					mat3 a2 = a[2][1];
443
444					float ret0 = a0[2][0];
445					float ret1 = a1[0][2];
446					float ret2 = a2[1][2];
447
448					out0 = vec3(ret0, ret1, ret2);
449					${OUTPUT}
450				}
451			""
452		end
453
454		case mat3_3x3x3
455			version 320 es
456			desc "Testing constructing explicitly sized arrays of arrays"
457			values
458			{
459				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
460				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
461			}
462
463			both ""
464				#version 320 es
465				precision mediump int;
466				precision mediump float;
467				${DECLARATIONS}
468
469				void main()
470				{
471					${SETUP}
472
473					mat3 a = mat3(	in0.x, in0.y, in0.z,
474									in0.x, in0.y, in0.z,
475									in0.x, in0.y, in0.z);
476					mat3 b = mat3(	in0.z, in0.x, -in0.y,
477									in0.z, in0.x, -in0.y,
478									in0.z, in0.x, -in0.y);
479					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
480									-in0.y, -in0.y, in0.y,
481									-in0.x, -in0.x, in0.x);
482
483					mat3[3][3][3] x = mat3[3][3][3] (	mat3[3][3] (mat3[3] (a, a, a),
484																	mat3[3] (b, b, b),
485																	mat3[3] (c, c, c)),
486
487														mat3[3][3] (mat3[3] (b, b, b),
488																	mat3[3] (a, a, a),
489																	mat3[3] (c, c, c)),
490
491														mat3[3][3] (mat3[3] (c, c, c),
492																	mat3[3] (a, a, a),
493																	mat3[3] (b, b, b)) );
494
495					mat3 x0 = x[0][0][0];
496					mat3 x1 = x[1][0][0];
497					mat3 x2 = x[2][0][0];
498
499					float ret0 = x0[2][0];
500					float ret1 = x1[0][2];
501					float ret2 = x2[1][2];
502
503					out0 = ivec3(ret0, ret1, ret2);
504					${OUTPUT}
505				}
506			""
507		end
508
509		case mat3_3x4
510			version 320 es
511			desc "Testing constructing explicitly sized arrays of arrays"
512			values
513			{
514				input bvec3 in0 = [ bvec3(true, false, true) ];
515				output bvec3 out0 = [ bvec3(true, false, false) ];
516			}
517
518			both ""
519				#version 320 es
520				precision mediump float;
521				${DECLARATIONS}
522
523				void main()
524				{
525					${SETUP}
526
527					mat3 a = mat3(	in0.x, in0.y, in0.z,
528									in0.x, in0.y, in0.z,
529									in0.x, in0.y, in0.z);
530
531					mat3 b = mat3(	in0.z, in0.x, in0.y,
532									in0.z, in0.x, in0.y,
533									in0.z, in0.x, in0.y);
534
535					mat3 c = mat3(	in0.z, in0.z, in0.z,
536									in0.y, in0.y, in0.y,
537									in0.x, in0.x, in0.x);
538
539					mat3[4] x[3] = mat3[3][4] (	mat3[4] (a, b, c, a),
540												mat3[4] (b, c, a, b),
541												mat3[4] (c, a, b, c) );
542
543					mat3 x0 = x[0][0];
544					mat3 x1 = x[1][3];
545					mat3 x2 = x[2][0];
546
547					float ret0 = x0[2][0];
548					float ret1 = x1[0][2];
549					float ret2 = x2[1][2];
550
551					out0 = bvec3(ret0, ret1, ret2);
552					${OUTPUT}
553				}
554			""
555		end
556
557		case high_dimensional_array
558			version 320 es
559			desc "Testing constructing explicitly sized arrays of arrays"
560			values
561			{
562				input ivec2 in0 = [ ivec2(1, -2) ];
563				output ivec2 out0 = [ ivec2(-2, 1) ];
564			}
565
566			both ""
567				#version 320 es
568				precision mediump float;
569				${DECLARATIONS}
570
571				void main()
572				{
573					${SETUP}
574
575					int[1][1][1][2][1][1][1] x = int[1][1][1][2][1][1][1] ( int[1][1][2][1][1][1] (int [1][2][1][1][1] ( int[2][1][1][1] (	int[1][1][1] ( int[1][1] (int[1] (in0.y))),
576																																			int[1][1][1] ( int[1][1] (int[1] (in0.x)))))));
577
578					out0 = ivec2(x[0][0][0][0][0][0][0], x[0][0][0][1][0][0][0]);
579					${OUTPUT}
580				}
581			""
582		end
583
584	end # explicit
585
586	group implicit "Testing constructors with implicit size"
587
588		case float_3x3
589			version 320 es
590			desc "Testing constructing implicitly sized arrays of arrays"
591			values
592			{
593				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
594				output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
595			}
596
597			both ""
598				#version 320 es
599				precision mediump float;
600				${DECLARATIONS}
601
602				void main()
603				{
604					${SETUP}
605					float[3][3] x;
606					x = float[][] ( float[](in0.z, in0.x, in0.y),
607									float[](in0.z, in0.x, in0.y),
608									float[](in0.z, in0.x, in0.y) );
609
610					out0 = vec3(x[0][0], x[1][1], x[2][2]);
611					${OUTPUT}
612				}
613			""
614		end
615
616		case float_3x4
617			version 320 es
618			desc "Testing constructing implicitly sized arrays of arrays"
619			values
620			{
621				input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 0.2) | vec4(7.4, -1.0, 2.0, -1.3) | vec4(3.0, 1.6, -2.0, 0.5) ];
622				output vec4 out0 = [ vec4(2.0, 0.5, 0.2, 1.0) | vec4(2.0, 7.4, -1.3, -1.0) | vec4(-2.0, 3.0, 0.5, 1.6) ];
623			}
624
625			both ""
626				#version 320 es
627				precision mediump float;
628				${DECLARATIONS}
629
630				void main()
631				{
632					${SETUP}
633					float[3][4] x;
634					x = float[][] ( float[] (in0.z, in0.x, in0.w, in0.y),
635									float[] (in0.z, in0.x, in0.w, in0.y),
636									float[] (in0.z, in0.x, in0.w, in0.y) );
637
638					out0 = vec4(x[0][0], x[1][1], x[2][2], x[2][3]);
639					${OUTPUT}
640				}
641			""
642		end
643
644		case int_3x1
645			version 320 es
646			desc "Testing constructing implicitly sized arrays of arrays"
647			values
648			{
649				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
650				output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
651			}
652
653			both ""
654				#version 320 es
655				precision mediump int;
656				precision mediump float;
657				${DECLARATIONS}
658
659				void main()
660				{
661					${SETUP}
662					int x[3][1];
663					x = int[][] ( int[] (in0.z),
664								  int[] (in0.x),
665								  int[] (in0.y) );
666
667					out0 = ivec3(x[0][0], x[1][0], x[2][0]);
668					${OUTPUT}
669				}
670			""
671		end
672
673		case int_4x4x4
674			version 320 es
675			desc "Testing constructing implicitly sized arrays of arrays"
676			values
677			{
678				input ivec4 in0 = [ ivec4(0, 1, 2, 0) | ivec4(7, -1, 2, -1) | ivec4(3, 1, -2, 0) ];
679				output ivec4 out0 = [ ivec4(2, 0, 0, 1) | ivec4(2, 7, -1, -1) | ivec4(-2, 3, 0, 1) ];
680			}
681
682			both ""
683				#version 320 es
684				precision mediump int;
685				precision mediump float;
686				${DECLARATIONS}
687
688				void main()
689				{
690					${SETUP}
691					int[4] x[4][4];
692					x = int[][][] ( int[][] ((int[] (in0.z, in0.x, in0.w, in0.y)),
693											 (int[] (in0.z, in0.x, in0.w, in0.y)),
694											 (int[] (in0.z, in0.x, in0.w, in0.y)),
695											 (int[] (in0.z, in0.x, in0.w, in0.y))),
696
697									int[][] ((int[] (in0.z, in0.x, in0.w, in0.y)),
698											 (int[] (in0.z, in0.x, in0.w, in0.y)),
699											 (int[] (in0.z, in0.x, in0.w, in0.y)),
700											 (int[] (in0.z, in0.x, in0.w, in0.y))),
701
702									int[][] ((int[] (in0.z, in0.x, in0.w, in0.y)),
703											 (int[] (in0.z, in0.x, in0.w, in0.y)),
704											 (int[] (in0.z, in0.x, in0.w, in0.y)),
705											 (int[] (in0.z, in0.x, in0.w, in0.y))),
706
707									int[][] ((int[] (in0.z, in0.x, in0.w, in0.y)),
708											 (int[] (in0.z, in0.x, in0.w, in0.y)),
709											 (int[] (in0.z, in0.x, in0.w, in0.y)),
710											 (int[] (in0.z, in0.x, in0.w, in0.y))) );
711
712					out0 = ivec4(x[0][0][0], x[1][1][1], x[2][2][2], x[3][3][3]);
713					${OUTPUT}
714				}
715			""
716		end
717
718		case bool_3x3x3
719			version 320 es
720			desc "Testing constructing implicitly sized arrays of arrays"
721			values
722			{
723				input bvec3 in0 = [ bvec3(true, true, false) ];
724				output bvec3 out0 = [ bvec3(false, true, true) ];
725			}
726
727			both ""
728				#version 320 es
729				precision mediump float;
730				${DECLARATIONS}
731
732				void main()
733				{
734					${SETUP}
735					bool[3][3][3] x;
736					x = bool[][][] (bool[][] (	(bool[] (in0.y, in0.y, in0.y)),
737												(bool[] (in0.z, in0.z, in0.z)),
738												(bool[] (in0.x, in0.x, in0.x))),
739
740									bool[][] (	(bool[] (in0.y, in0.y, in0.y)),
741												(bool[] (in0.z, in0.z, in0.z)),
742												(bool[] (in0.x, in0.x, in0.x))),
743
744									bool[][] (	(bool[] (in0.y, in0.y, in0.y)),
745												(bool[] (in0.z, in0.z, in0.z)),
746												(bool[] (in0.x, in0.x, in0.x))) );
747
748					out0 = bvec3(x[1][1][1], x[0][0][0], x[2][2][2]);
749					${OUTPUT}
750				}
751			""
752		end
753
754		case bool_2x1x4
755			version 320 es
756			desc "Testing constructing implicitly sized arrays of arrays"
757			values
758			{
759				input bvec4 in0 = [ bvec4(true, true, false, false) ];
760				output bvec4 out0 = [ bvec4(false, true, true, false) ];
761			}
762
763			both ""
764				#version 320 es
765				precision mediump float;
766				${DECLARATIONS}
767
768				void main()
769				{
770					${SETUP}
771					bool x[2][1][4];
772					x = bool[2][1][4] ( bool[][] ((bool[] (in0.z, in0.x, in0.y, in0.w))),
773										bool[][] ((bool[] (in0.z, in0.x, in0.y, in0.w))) );
774					out0 = bvec4(x[0][0][0], x[0][0][1], x[1][0][2], x[1][0][3]);
775					${OUTPUT}
776				}
777			""
778		end
779
780		case struct_3x2
781			version 320 es
782			desc "Testing constructing implicitly sized arrays of arrays"
783			values
784			{
785				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
786				output vec3 out0 = [ vec3(2.0, -0.5, -1.0) ];
787			}
788
789			both ""
790				#version 320 es
791				precision mediump float;
792				${DECLARATIONS}
793
794				void main()
795				{
796					${SETUP}
797
798					struct Test
799					{
800						float f;
801						vec3 v;
802					};
803
804					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
805					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
806					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
807
808					Test[2] x[3] = Test[][] (	(Test[] (a, b)),
809												(Test[] (c, a)),
810											    (Test[] (b, c)) );
811
812					out0 = vec3(x[0][0].f, x[0][1].v.y, x[2][1].v.x);
813					${OUTPUT}
814				}
815			""
816		end
817
818		case struct_4x1x4
819			version 320 es
820			desc "Testing constructing implicitly sized arrays of arrays"
821			values
822			{
823				input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 1.5) ];
824				output vec4 out0 = [ vec4(2.0, -0.5, -1.0, -1.5) ];
825			}
826
827			both ""
828				#version 320 es
829				precision mediump float;
830				${DECLARATIONS}
831
832				void main()
833				{
834					${SETUP}
835
836
837					struct Test
838					{
839						float f;
840						vec3 v;
841					};
842
843					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
844					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
845					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
846					Test d = Test(-in0.w, vec3(-in0.w, -in0.x, -in0.z));
847
848					Test[4] x[4][1] = Test[][][] (	(Test[][] (Test[] (a, b, c, d))),
849													(Test[][] (Test[] (a, b, c, d))),
850													(Test[][] (Test[] (a, b, c, d))),
851													(Test[][] (Test[] (a, b, c, d))) );
852
853					out0 = vec4(x[0][0][0].f, x[1][0][1].v.y, x[2][0][2].v.x, x[3][0][3].v.x);
854					${OUTPUT}
855				}
856			""
857		end
858
859		case vec3_4x3
860			version 320 es
861			desc "Testing constructing implicitly sized arrays of arrays"
862			values
863			{
864				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
865				output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(7.4, -2.0, -1.0) | vec3(3.0, 2.0, 1.6) ];
866			}
867
868			both ""
869				#version 320 es
870				precision mediump float;
871				${DECLARATIONS}
872
873				void main()
874				{
875					${SETUP}
876
877					vec3[3] x[4];
878					x = vec3[][] (		vec3[]		(	vec3(in0.x, in0.y, in0.z),
879												vec3(-in0.y, -in0.z, -in0.x),
880												vec3(in0.z, in0.x, in0.y)),
881									vec3[]		(	vec3(in0.x, in0.y, in0.z),
882												vec3(-in0.y, -in0.z, -in0.x),
883												vec3(in0.z, in0.x, in0.y)),
884
885									vec3[]		(	vec3(in0.x, in0.y, in0.z),
886												vec3(-in0.y, -in0.z, -in0.x),
887												vec3(in0.z, in0.x, in0.y)),
888
889									vec3[]		(	vec3(in0.x, in0.y, in0.z),
890												vec3(-in0.y, -in0.z, -in0.x),
891												vec3(in0.z, in0.x, in0.y)) );
892
893					out0 = vec3(x[0][0].x, x[1][1].y, x[3][2].z);
894					${OUTPUT}
895				}
896			""
897		end
898
899		case ivec3_3x2x1
900			version 320 es
901			desc "Testing constructing implicitly sized arrays of arrays"
902			values
903			{
904				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
905				output ivec3 out0 = [ ivec3(5, -2, 1) | ivec3(7, -2, -1) | ivec3(3, 2, 1) ];
906			}
907
908			both ""
909				#version 320 es
910				precision mediump int;
911				precision mediump float;
912				${DECLARATIONS}
913
914				void main()
915				{
916					${SETUP}
917
918					ivec3 x[3][2][1];
919					x = ivec3[][][] (		ivec3[][] (	ivec3[] (ivec3(in0.x, in0.y, in0.z)),
920													ivec3[] (ivec3(-in0.y, -in0.z, -in0.x))),
921										ivec3[][] (	ivec3[] (ivec3(in0.z, in0.x, in0.y)),
922													ivec3[] (ivec3(in0.x, in0.y, in0.z))),
923										ivec3[][] (	ivec3[] (ivec3(-in0.y, -in0.z, -in0.x)),
924													ivec3[] (ivec3(in0.z, in0.x, in0.y))) );
925					out0 = ivec3(x[0][0][0].x, x[2][0][0].y, x[1][0][0].z);
926					${OUTPUT}
927				}
928			""
929		end
930
931		case bvec3_1x2x3
932			version 320 es
933			desc "Testing constructing implicitly sized arrays of arrays"
934			values
935			{
936				input bvec3 in0 = [ bvec3(true, false, true) ];
937				output bvec3 out0 = [ bvec3(true, true, false) ];
938			}
939
940			both ""
941				#version 320 es
942				precision mediump float;
943				${DECLARATIONS}
944
945				void main()
946				{
947					${SETUP}
948
949					bvec3[3] x[1][2];
950					x = bvec3[][][] (		bvec3[][] (	bvec3[] (bvec3(in0.x, in0.y, in0.z),
951															 bvec3(in0.y, in0.z, in0.x),
952															 bvec3(in0.z, in0.x, in0.y)),
953
954													bvec3[] (bvec3(in0.z, in0.x, in0.y),
955															 bvec3(in0.x, in0.y, in0.z),
956															 bvec3(in0.y, in0.z, in0.x)) ));
957
958					out0 = bvec3(x[0][0][0].x, x[0][0][1].y, x[0][1][0].z);
959					${OUTPUT}
960				}
961			""
962		end
963
964		case mat3_3x2
965			version 320 es
966			desc "Testing constructing implicitly sized arrays of arrays"
967			values
968			{
969				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
970				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
971			}
972
973			both ""
974				#version 320 es
975				precision mediump float;
976				${DECLARATIONS}
977
978				void main()
979				{
980					${SETUP}
981					mat3[3][2] a = mat3[][] (	mat3[] (mat3(	in0.x, in0.y, in0.z,
982																in0.x, in0.y, in0.z,
983																in0.x, in0.y, in0.z),
984														mat3(	in0.z, in0.x, -in0.y,
985																in0.z, in0.x, -in0.y,
986																in0.z, in0.x, -in0.y)),
987
988												mat3[] (mat3(	-in0.z, -in0.z, in0.z,
989																-in0.y, -in0.y, in0.y,
990																-in0.x, -in0.x, in0.x),
991														mat3(	in0.x, in0.y, in0.z,
992																in0.x, in0.y, in0.z,
993																in0.x, in0.y, in0.z)),
994
995												mat3[] (mat3(	in0.z, in0.x, -in0.y,
996																in0.z, in0.x, -in0.y,
997																in0.z, in0.x, -in0.y),
998														mat3(	-in0.z, -in0.z, in0.z,
999																-in0.y, -in0.y, in0.y,
1000																-in0.x, -in0.x, in0.x)) );
1001
1002					mat3 a0 = a[0][0];
1003					mat3 a1 = a[0][1];
1004					mat3 a2 = a[2][1];
1005
1006					float ret0 = a0[2][0];
1007					float ret1 = a1[0][2];
1008					float ret2 = a2[1][2];
1009
1010					out0 = vec3(ret0, ret1, ret2);
1011					${OUTPUT}
1012				}
1013			""
1014		end
1015
1016		case mat3_3x3x3
1017			version 320 es
1018			desc "Testing constructing implicitly sized arrays of arrays"
1019			values
1020			{
1021				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
1022				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
1023			}
1024
1025			both ""
1026				#version 320 es
1027				precision mediump int;
1028				precision mediump float;
1029				${DECLARATIONS}
1030
1031				void main()
1032				{
1033					${SETUP}
1034
1035					mat3 a = mat3(	in0.x, in0.y, in0.z,
1036									in0.x, in0.y, in0.z,
1037									in0.x, in0.y, in0.z);
1038					mat3 b = mat3(	in0.z, in0.x, -in0.y,
1039									in0.z, in0.x, -in0.y,
1040									in0.z, in0.x, -in0.y);
1041					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
1042									-in0.y, -in0.y, in0.y,
1043									-in0.x, -in0.x, in0.x);
1044
1045					mat3[3][3][3] x = mat3[][][] (	mat3[][] (		mat3[] (a, a, a),
1046																mat3[] (b, b, b),
1047																mat3[] (c, c, c)),
1048
1049													mat3[][] (		mat3[] (b, b, b),
1050																mat3[] (a, a, a),
1051																mat3[] (c, c, c)),
1052
1053													mat3[][] (		mat3[] (c, c, c),
1054																mat3[] (a, a, a),
1055																mat3[] (b, b, b)) );
1056
1057					mat3 x0 = x[0][0][0];
1058					mat3 x1 = x[1][0][0];
1059					mat3 x2 = x[2][0][0];
1060
1061					float ret0 = x0[2][0];
1062					float ret1 = x1[0][2];
1063					float ret2 = x2[1][2];
1064
1065					out0 = ivec3(ret0, ret1, ret2);
1066					${OUTPUT}
1067				}
1068			""
1069		end
1070
1071		case mat3_3x4
1072			version 320 es
1073			desc "Testing constructing implicitly sized arrays of arrays"
1074			values
1075			{
1076				input bvec3 in0 = [ bvec3(true, false, true) ];
1077				output bvec3 out0 = [ bvec3(true, false, false) ];
1078			}
1079
1080			both ""
1081				#version 320 es
1082				precision mediump float;
1083				${DECLARATIONS}
1084
1085				void main()
1086				{
1087					${SETUP}
1088
1089					mat3 a = mat3(	in0.x, in0.y, in0.z,
1090									in0.x, in0.y, in0.z,
1091									in0.x, in0.y, in0.z);
1092
1093					mat3 b = mat3(	in0.z, in0.x, in0.y,
1094									in0.z, in0.x, in0.y,
1095									in0.z, in0.x, in0.y);
1096
1097					mat3 c = mat3(	in0.z, in0.z, in0.z,
1098									in0.y, in0.y, in0.y,
1099									in0.x, in0.x, in0.x);
1100
1101					mat3[4] x[3] = mat3[][] (	mat3[] (a, b, c, a),
1102												mat3[] (b, c, a, b),
1103												mat3[] (c, a, b, c) );
1104
1105					mat3 x0 = x[0][0];
1106					mat3 x1 = x[1][3];
1107					mat3 x2 = x[2][0];
1108
1109					float ret0 = x0[2][0];
1110					float ret1 = x1[0][2];
1111					float ret2 = x2[1][2];
1112
1113					out0 = bvec3(ret0, ret1, ret2);
1114					${OUTPUT}
1115				}
1116			""
1117		end
1118
1119		case int_high_dimensional_array
1120			version 320 es
1121			desc "Testing constructing implicitly sized arrays of arrays"
1122			values
1123			{
1124				input ivec2 in0 = [ ivec2(1, -2) ];
1125				output ivec2 out0 = [ ivec2(-2, 1) ];
1126			}
1127
1128			both ""
1129				#version 320 es
1130				precision mediump float;
1131				${DECLARATIONS}
1132
1133				void main()
1134				{
1135					${SETUP}
1136
1137					int[][][][][][][] x = int[][][][][][][] ( int[][][][][][] (int [][][][][] ( int[][][][] (	int[][][] ( int[][] (int[] (in0.y))),
1138																												int[][][] ( int[][] (int[] (in0.x)))))));
1139
1140					out0 = ivec2(x[0][0][0][0][0][0][0], x[0][0][0][1][0][0][0]);
1141					${OUTPUT}
1142				}
1143			""
1144		end
1145
1146	end # implicit
1147
1148end # constructor
1149
1150group return "Array of arrays as return value"
1151
1152	group explicit "Testing return value with explicit constructor"
1153
1154		case float_3x3
1155			version 320 es
1156			desc "Testing arrays of arrays as function return values with explicit array size"
1157			values
1158			{
1159				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
1160				output vec3 out0 = [ vec3(2.0, -0.5, 1.0) | vec3(2.0, -7.4, -1.0) | vec3(-2.0, -3.0, 1.6) ];
1161			}
1162
1163			both ""
1164				#version 320 es
1165				precision mediump float;
1166				${DECLARATIONS}
1167
1168				float[3][3] func(vec3 a)
1169				{
1170					return float[3][3] (float[3] (a.z, 0.0, 0.0),
1171										float[3] (0.0, -a.x, 0.0),
1172										float[3] (0.0, 0.0, a.y) );
1173				}
1174
1175				void main()
1176				{
1177					${SETUP}
1178					float[3][3] x = func(in0);
1179					out0 = vec3(x[0][0], x[1][1], x[2][2]);
1180					${OUTPUT}
1181				}
1182			""
1183		end
1184
1185		case int_2x2x2
1186			version 320 es
1187			desc "Testing arrays of arrays as function return values with explicit array size"
1188			values
1189			{
1190				input ivec2 in0 = [ ivec2(4, 1) | ivec2(7, -1) | ivec2(3, 1) ];
1191				output ivec2 out0 =	[ ivec2(1, -4) | ivec2(-1, -7) | ivec2(1, -3) ];
1192			}
1193
1194			both ""
1195				#version 320 es
1196				precision mediump int;
1197				precision mediump float;
1198				${DECLARATIONS}
1199
1200				int[2][2][2] func(ivec2 a)
1201				{
1202					return int[2][2][2] (	int[2][2] (	int[2] (a.y, -a.x),
1203														int[2] (0, 0)),
1204											int[2][2] (	int[2] (0, 0),
1205														int[2] (a.y, -a.x)) );
1206				}
1207
1208				void main()
1209				{
1210					${SETUP}
1211					int[2][2][2] x = func(in0);
1212					out0 = ivec2(x[0][0][0], x[1][1][1]);
1213					${OUTPUT}
1214				}
1215			""
1216		end
1217
1218		case bool_3x2x3
1219			version 320 es
1220			desc "Testing arrays of arrays as function return values with explicit array size"
1221			values
1222			{
1223				input bvec3 in0 =		[ bvec3(false, true, true) ];
1224				output bvec3 out0 = [ bvec3(true, false, true) ];
1225			}
1226
1227			both ""
1228				#version 320 es
1229				precision mediump float;
1230				${DECLARATIONS}
1231
1232				bool[3][2][3] func(bvec3 a)
1233				{
1234					return bool[3][2][3] (	bool[2][3] (bool[3] (a.z, a.x, a.y),
1235														bool[3] (a.x, a.y, a.z)),
1236											bool[2][3] (bool[3] (a.x, a.y, a.z),
1237														bool[3] (a.z, a.x, a.y)),
1238											bool[2][3] (bool[3] (a.y, a.z, a.x),
1239														bool[3] (a.y, a.z, a.x)) );
1240				}
1241
1242				void main()
1243				{
1244					${SETUP}
1245					bool[3] x[3][2] = func(in0);
1246					out0 = bvec3(x[0][0][0], x[1][1][1], x[2][1][0]);
1247					${OUTPUT}
1248				}
1249			""
1250		end
1251
1252
1253		case vec3_2x3
1254			version 320 es
1255			desc "Testing arrays of arrays as function return values with explicit array size"
1256			values
1257			{
1258				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
1259				output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
1260			}
1261
1262			both ""
1263				#version 320 es
1264				precision mediump float;
1265				${DECLARATIONS}
1266
1267				vec3[2][3] func(vec3 p)
1268				{
1269					vec3[2][3] a = vec3[2][3](	vec3[3] (vec3(p.x, p.y, -p.z),
1270														vec3(p.y, -p.z, p.x),
1271														vec3(-p.z, p.x, p.y)),
1272												vec3[3] (vec3(p.y, -p.z, p.x),
1273														vec3(p.x, p.y, -p.z),
1274														vec3(-p.z, p.x, p.y)) );
1275
1276					return vec3[2][3] ( vec3[3] (a[0][1], a[0][2], a[0][0]),
1277										vec3[3] (a[1][1], a[1][2], a[1][0]));
1278				}
1279
1280				void main()
1281				{
1282					${SETUP}
1283
1284					vec3[2][3] x = func(in0);
1285					out0 = vec3(x[0][0].x, x[1][1].y, x[0][2].z);
1286					${OUTPUT}
1287				}
1288			""
1289		end
1290
1291		case struct_3x1x3
1292			version 320 es
1293			desc "Testing arrays of arrays as function return values with explicit array size"
1294			values
1295			{
1296				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1297				output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
1298			}
1299
1300			both ""
1301				#version 320 es
1302				precision mediump float;
1303				${DECLARATIONS}
1304
1305				struct Test
1306				{
1307					float f;
1308					vec3 v;
1309				};
1310
1311				Test[3][1][3] func(vec3 p)
1312				{
1313					Test a = Test(p.z, vec3(p.x, p.y, p.z));
1314					Test b = Test(p.y, vec3(-p.z, -p.x, -p.y));
1315					Test c = Test(p.x, vec3(-p.y, p.z, -p.x));
1316
1317					return Test[3][1][3] (	Test[1][3] (Test[3] (b, b, b)),
1318											Test[1][3] (Test[3] (a, a, a)),
1319											Test[1][3] (Test[3] (c, c, c)) );
1320				}
1321
1322				void main()
1323				{
1324					${SETUP}
1325					Test[3][1][3] x = func(in0);
1326					out0 = vec3(x[0][0][0].v.z, x[2][0][2].v.y, x[1][0][1].v.x);
1327					${OUTPUT}
1328				}
1329			""
1330		end
1331
1332		case ivec3_3x3
1333			version 320 es
1334			desc "Testing arrays of arrays as function return values with explicit array size"
1335			values
1336			{
1337				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
1338				output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
1339			}
1340
1341			both ""
1342				#version 320 es
1343				precision mediump int;
1344				precision mediump float;
1345				${DECLARATIONS}
1346
1347				ivec3[3][3] func(ivec3 p)
1348				{
1349					ivec3[3][3] a = ivec3[3][3] (	ivec3[3] (	ivec3(p.x, p.y, -p.z),
1350																ivec3(p.x, p.y, -p.z),
1351																ivec3(p.x, p.y, -p.z)),
1352
1353													ivec3[3] (	ivec3(p.y, -p.z, p.x),
1354																ivec3(p.y, -p.z, p.x),
1355																ivec3(p.y, -p.z, p.x)),
1356
1357													ivec3[3] (	ivec3(-p.z, p.x, p.y),
1358																ivec3(-p.z, p.x, p.y),
1359																ivec3(-p.z, p.x, p.y)) );
1360					return a;
1361				}
1362
1363				void main()
1364				{
1365					${SETUP}
1366					ivec3[3][3] x = func(in0);
1367					out0 = ivec3(x[1][0].x, x[2][0].y, x[0][2].z);
1368					${OUTPUT}
1369				}
1370			""
1371		end
1372
1373		case bvec4_4x2
1374			version 320 es
1375			desc "Testing arrays of arrays as function return values with explicit array size"
1376			values
1377			{
1378				input bvec4 in0 =		[ bvec4(true, false, false, true) ];
1379				output bvec4 out0 = [ bvec4(true, true, false, true) ];
1380			}
1381
1382			both ""
1383				#version 320 es
1384				precision mediump int;
1385				precision mediump float;
1386				${DECLARATIONS}
1387
1388				bvec4[4][2] func(bvec4 p)
1389				{
1390					bvec4[4] x = bvec4[4](	bvec4(p.x, p.y, p.z, p.w),
1391											bvec4(p.w, p.y, p.z, p.x),
1392											bvec4(p.z, p.w, p.x, p.y),
1393											bvec4(p.y, p.x, p.z, p.w) );
1394
1395					return bvec4[4][2] ( bvec4[2] (bvec4(x[0]),
1396												  bvec4(x[1])),
1397
1398										 bvec4[2] (bvec4(x[2]),
1399												  bvec4(x[3])),
1400
1401										 bvec4[2] (bvec4(x[1]),
1402												  bvec4(x[2])),
1403
1404										 bvec4[2] (bvec4(x[3]),
1405												  bvec4(x[0])) );
1406				}
1407
1408				void main()
1409				{
1410					${SETUP}
1411					bvec4[4][2] x = func(in0);
1412					out0 = bvec4(x[0][1].x, x[1][0].y, x[2][0].z, x[3][1].w);
1413					${OUTPUT}
1414				}
1415			""
1416		end
1417
1418		case mat3_3x2
1419			version 320 es
1420			desc "Testing arrays of arrays as function return values with explicit array size"
1421			values
1422			{
1423				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
1424				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
1425			}
1426
1427			both ""
1428				#version 320 es
1429				precision mediump float;
1430				${DECLARATIONS}
1431
1432				mat3[3][2] func(vec3 p)
1433				{
1434					mat3[3][2] a = mat3[3][2] (	mat3[2] (mat3(	p.x, p.y, p.z,
1435																p.x, p.y, p.z,
1436																p.x, p.y, p.z),
1437														mat3(	p.z, p.x, -p.y,
1438																p.z, p.x, -p.y,
1439																p.z, p.x, -p.y)),
1440
1441												mat3[2] (mat3(	-p.z, -p.z, p.z,
1442																-p.y, -p.y, p.y,
1443																-p.x, -p.x, p.x),
1444														mat3(	p.x, p.y, p.z,
1445																p.x, p.y, p.z,
1446																p.x, p.y, p.z)),
1447
1448												mat3[2] (mat3(	p.z, p.x, -p.y,
1449																p.z, p.x, -p.y,
1450																p.z, p.x, -p.y),
1451														mat3(	-p.z, -p.z, p.z,
1452																-p.y, -p.y, p.y,
1453																-p.x, -p.x, p.x)) );
1454
1455					return a;
1456				}
1457
1458				void main()
1459				{
1460					${SETUP}
1461
1462					mat3 a[3][2] = func(in0);
1463
1464					mat3 a0 = a[0][0];
1465					mat3 a1 = a[0][1];
1466					mat3 a2 = a[2][1];
1467
1468					float ret0 = a0[2][0];
1469					float ret1 = a1[0][2];
1470					float ret2 = a2[1][2];
1471
1472					out0 = vec3(ret0, ret1, ret2);
1473					${OUTPUT}
1474				}
1475			""
1476		end
1477
1478		case mat3_3x3x3
1479			version 320 es
1480			desc "Testing arrays of arrays as function return values with explicit array size"
1481			values
1482			{
1483				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
1484				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
1485			}
1486
1487			both ""
1488				#version 320 es
1489				precision mediump int;
1490				precision mediump float;
1491				${DECLARATIONS}
1492
1493				mat3[3][3][3] func(ivec3 p)
1494				{
1495					mat3 a = mat3(	p.x, p.y, p.z,
1496									p.x, p.y, p.z,
1497									p.x, p.y, p.z);
1498					mat3 b = mat3(	p.z, p.x, -p.y,
1499									p.z, p.x, -p.y,
1500									p.z, p.x, -p.y);
1501					mat3 c = mat3(	-p.z, -p.z, p.z,
1502									-p.y, -p.y, p.y,
1503									-p.x, -p.x, p.x);
1504
1505					return mat3[3][3][3] (	mat3[3][3] (mat3[3] (a, a, a),
1506														mat3[3] (b, b, b),
1507														mat3[3] (c, c, c)),
1508
1509											mat3[3][3] (mat3[3] (b, b, b),
1510														mat3[3] (a, a, a),
1511														mat3[3] (c, c, c)),
1512
1513											mat3[3][3] (mat3[3] (c, c, c),
1514														mat3[3] (a, a, a),
1515														mat3[3] (b, b, b)) );
1516				}
1517
1518				void main()
1519				{
1520					${SETUP}
1521
1522					mat3 x[3][3][3] = func(in0);
1523
1524					mat3 x0 = x[0][0][0];
1525					mat3 x1 = x[1][0][0];
1526					mat3 x2 = x[2][0][0];
1527
1528					float ret0 = x0[2][0];
1529					float ret1 = x1[0][2];
1530					float ret2 = x2[1][2];
1531
1532					out0 = ivec3(ret0, ret1, ret2);
1533					${OUTPUT}
1534				}
1535			""
1536		end
1537
1538		case mat3_3x4
1539			version 320 es
1540			desc "Testing arrays of arrays as function return values with explicit array size"
1541			values
1542			{
1543				input bvec3 in0 = [ bvec3(true, false, true) ];
1544				output bvec3 out0 = [ bvec3(true, false, false) ];
1545			}
1546
1547			both ""
1548				#version 320 es
1549				precision mediump float;
1550				${DECLARATIONS}
1551
1552				mat3[3][4] func(bvec3 p)
1553				{
1554					mat3 a = mat3(	p.x, p.y, p.z,
1555									p.x, p.y, p.z,
1556									p.x, p.y, p.z);
1557
1558					mat3 b = mat3(	p.z, p.x, p.y,
1559									p.z, p.x, p.y,
1560									p.z, p.x, p.y);
1561
1562					mat3 c = mat3(	p.z, p.z, p.z,
1563									p.y, p.y, p.y,
1564									p.x, p.x, p.x);
1565
1566					return mat3[3][4] (	mat3[4] (a, b, c, a),
1567										mat3[4] (b, c, a, b),
1568										mat3[4] (c, a, b, c) );
1569				}
1570
1571				void main()
1572				{
1573					${SETUP}
1574
1575					mat3[4] x[3] = func(in0);
1576
1577					mat3 x0 = x[0][0];
1578					mat3 x1 = x[1][3];
1579					mat3 x2 = x[2][0];
1580
1581					float ret0 = x0[2][0];
1582					float ret1 = x1[0][2];
1583					float ret2 = x2[1][2];
1584
1585					out0 = bvec3(ret0, ret1, ret2);
1586					${OUTPUT}
1587				}
1588			""
1589		end
1590
1591	end # explicit
1592
1593	group implicit "Test return value with implicit constructor"
1594
1595		case float_3x3
1596			version 320 es
1597			desc "Testing arrays of arrays as function return values with implicit array size"
1598			values
1599			{
1600				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
1601				output vec3 out0 = [ vec3(2.0, -0.5, 1.0) | vec3(2.0, -7.4, -1.0) | vec3(-2.0, -3.0, 1.6) ];
1602			}
1603
1604			both ""
1605				#version 320 es
1606				precision mediump float;
1607				${DECLARATIONS}
1608
1609				float[3][3] func(vec3 a)
1610				{
1611					return float[][] (	float[] (a.z, 0.0, 0.0),
1612										float[] (0.0, -a.x, 0.0),
1613										float[] (0.0, 0.0, a.y) );
1614				}
1615
1616				void main()
1617				{
1618					${SETUP}
1619					float[3][3] x = func(in0);
1620					out0 = vec3(x[0][0], x[1][1], x[2][2]);
1621					${OUTPUT}
1622				}
1623			""
1624		end
1625
1626		case int_2x2x2
1627			version 320 es
1628			desc "Testing arrays of arrays as function return values with implicit array size"
1629			values
1630			{
1631				input ivec2 in0 = [ ivec2(4, 1) | ivec2(7, -1) | ivec2(3, 1) ];
1632				output ivec2 out0 =	[ ivec2(1, -4) | ivec2(-1, -7) | ivec2(1, -3) ];
1633			}
1634
1635			both ""
1636				#version 320 es
1637				precision mediump int;
1638				precision mediump float;
1639				${DECLARATIONS}
1640
1641				int[2][2][2] func(ivec2 a)
1642				{
1643					return int[][][] (	int[][] (	int[] (a.y, -a.x),
1644													int[] (0, 0)),
1645										int[][] (	int[] (0, 0),
1646													int[] (a.y, -a.x)) );
1647				}
1648
1649				void main()
1650				{
1651					${SETUP}
1652					int[2][2][2] x = func(in0);
1653					out0 = ivec2(x[0][0][0], x[1][1][1]);
1654					${OUTPUT}
1655				}
1656			""
1657		end
1658
1659		case bool_3x2x3
1660			version 320 es
1661			desc "Testing arrays of arrays as function return values with implicit array size"
1662			values
1663			{
1664				input bvec3 in0 =		[ bvec3(false, true, true) ];
1665				output bvec3 out0 = [ bvec3(true, false, true) ];
1666			}
1667
1668			both ""
1669				#version 320 es
1670				precision mediump float;
1671				${DECLARATIONS}
1672
1673				bool[3][2][3] func(bvec3 a)
1674				{
1675					return bool[][][] (	bool[][] (	bool[] (a.z, a.x, a.y),
1676													bool[] (a.x, a.y, a.z)),
1677										bool[][] (	bool[] (a.x, a.y, a.z),
1678													bool[] (a.z, a.x, a.y)),
1679										bool[][] (	bool[] (a.y, a.z, a.x),
1680													bool[] (a.y, a.z, a.x)) );
1681				}
1682
1683				void main()
1684				{
1685					${SETUP}
1686					bool[3] x[3][2] = func(in0);
1687					out0 = bvec3(x[0][0][0], x[1][1][1], x[2][1][0]);
1688					${OUTPUT}
1689				}
1690			""
1691		end
1692
1693		case vec3_2x3
1694			version 320 es
1695			desc "Testing arrays of arrays as function return values with implicit array size"
1696			values
1697			{
1698				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
1699				output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
1700			}
1701
1702			both ""
1703				#version 320 es
1704				precision mediump float;
1705				${DECLARATIONS}
1706
1707				vec3[2][3] func(vec3 p)
1708				{
1709					vec3[2][3] a = vec3[2][3](	vec3[3] (	vec3(p.x, p.y, -p.z),
1710															vec3(p.y, -p.z, p.x),
1711															vec3(-p.z, p.x, p.y)),
1712												vec3[3] (	vec3(p.y, -p.z, p.x),
1713															vec3(p.x, p.y, -p.z),
1714															vec3(-p.z, p.x, p.y)) );
1715
1716					return vec3[][] (		vec3[] (a[0][1], a[0][2], a[0][0]),
1717										vec3[] (a[1][1], a[1][2], a[1][0]));
1718				}
1719
1720				void main()
1721				{
1722					${SETUP}
1723
1724					vec3[2][3] x = func(in0);
1725					out0 = vec3(x[0][0].x, x[1][1].y, x[0][2].z);
1726					${OUTPUT}
1727				}
1728			""
1729		end
1730
1731		case struct_3x1x3
1732			version 320 es
1733			desc "Testing arrays of arrays as function return values with implicit array size"
1734			values
1735			{
1736				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1737				output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
1738			}
1739
1740			both ""
1741				#version 320 es
1742				precision mediump float;
1743				${DECLARATIONS}
1744
1745				struct Test
1746				{
1747					float f;
1748					vec3 v;
1749				};
1750
1751				Test[3][1][3] func(vec3 p)
1752				{
1753					Test a = Test(p.z, vec3(p.x, p.y, p.z));
1754					Test b = Test(p.y, vec3(-p.z, -p.x, -p.y));
1755					Test c = Test(p.x, vec3(-p.y, p.z, -p.x));
1756
1757					return Test[][][] (	Test[][] (Test[] (b, b, b)),
1758										Test[][] (Test[] (a, a, a)),
1759										Test[][] (Test[] (c, c, c)) );
1760				}
1761
1762				void main()
1763				{
1764					${SETUP}
1765					Test[3][1][3] x = func(in0);
1766					out0 = vec3(x[0][0][0].v.z, x[2][0][2].v.y, x[1][0][1].v.x);
1767					${OUTPUT}
1768				}
1769			""
1770		end
1771
1772		case ivec3_3x3
1773			version 320 es
1774			desc "Testing arrays of arrays as function return values with implicit array size"
1775			values
1776			{
1777				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
1778				output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
1779			}
1780
1781			both ""
1782				#version 320 es
1783				precision mediump int;
1784				precision mediump float;
1785				${DECLARATIONS}
1786
1787				ivec3[3][3] func(ivec3 p)
1788				{
1789					return ivec3[][] (	ivec3[] (	ivec3(p.x, p.y, -p.z),
1790													ivec3(p.x, p.y, -p.z),
1791													ivec3(p.x, p.y, -p.z)),
1792
1793										ivec3[] (	ivec3(p.y, -p.z, p.x),
1794													ivec3(p.y, -p.z, p.x),
1795													ivec3(p.y, -p.z, p.x)),
1796
1797										ivec3[] (	ivec3(-p.z, p.x, p.y),
1798													ivec3(-p.z, p.x, p.y),
1799													ivec3(-p.z, p.x, p.y)) );
1800				}
1801
1802				void main()
1803				{
1804					${SETUP}
1805					ivec3[3][3] x = func(in0);
1806					out0 = ivec3(x[1][0].x, x[2][0].y, x[0][2].z);
1807					${OUTPUT}
1808				}
1809			""
1810		end
1811
1812		case bvec4_4x2
1813			version 320 es
1814			desc "Testing arrays of arrays as function return values with implicit array size"
1815			values
1816			{
1817				input bvec4 in0 =		[ bvec4(true, false, false, true) ];
1818				output bvec4 out0 = [ bvec4(true, true, false, true) ];
1819			}
1820
1821			both ""
1822				#version 320 es
1823				precision mediump int;
1824				precision mediump float;
1825				${DECLARATIONS}
1826
1827				bvec4[4][2] func(bvec4 p)
1828				{
1829					bvec4[4] x = bvec4[4](	bvec4(p.x, p.y, p.z, p.w),
1830											bvec4(p.w, p.y, p.z, p.x),
1831											bvec4(p.z, p.w, p.x, p.y),
1832											bvec4(p.y, p.x, p.z, p.w) );
1833
1834					return bvec4[][] (		bvec4[] (bvec4(x[0]),
1835												 bvec4(x[1])),
1836
1837										bvec4[] (bvec4(x[2]),
1838												 bvec4(x[3])),
1839
1840										bvec4[] (bvec4(x[1]),
1841												 bvec4(x[2])),
1842
1843										bvec4[] (bvec4(x[3]),
1844												 bvec4(x[0])) );
1845				}
1846
1847				void main()
1848				{
1849					${SETUP}
1850					bvec4[4][2] x = func(in0);
1851					out0 = bvec4(x[0][1].x, x[1][0].y, x[2][0].z, x[3][1].w);
1852					${OUTPUT}
1853				}
1854			""
1855		end
1856
1857		case mat3_3x2
1858			version 320 es
1859			desc "Testing arrays of arrays as function return values with implicit array size"
1860			values
1861			{
1862				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
1863				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
1864			}
1865
1866			both ""
1867				#version 320 es
1868				precision mediump float;
1869				${DECLARATIONS}
1870
1871				mat3[3][2] func(vec3 p)
1872				{
1873					return mat3[][] (	mat3[] (mat3(	p.x, p.y, p.z,
1874														p.x, p.y, p.z,
1875														p.x, p.y, p.z),
1876												mat3(	p.z, p.x, -p.y,
1877														p.z, p.x, -p.y,
1878														p.z, p.x, -p.y)),
1879
1880										mat3[] (mat3(	-p.z, -p.z, p.z,
1881														-p.y, -p.y, p.y,
1882														-p.x, -p.x, p.x),
1883												mat3(	p.x, p.y, p.z,
1884														p.x, p.y, p.z,
1885														p.x, p.y, p.z)),
1886
1887										mat3[] (mat3(	p.z, p.x, -p.y,
1888														p.z, p.x, -p.y,
1889														p.z, p.x, -p.y),
1890												mat3(	-p.z, -p.z, p.z,
1891														-p.y, -p.y, p.y,
1892														-p.x, -p.x, p.x)) );
1893
1894				}
1895
1896				void main()
1897				{
1898					${SETUP}
1899
1900					mat3 a[3][2] = func(in0);
1901
1902					mat3 a0 = a[0][0];
1903					mat3 a1 = a[0][1];
1904					mat3 a2 = a[2][1];
1905
1906					float ret0 = a0[2][0];
1907					float ret1 = a1[0][2];
1908					float ret2 = a2[1][2];
1909
1910					out0 = vec3(ret0, ret1, ret2);
1911					${OUTPUT}
1912				}
1913			""
1914		end
1915
1916		case mat3_3x3x3
1917			version 320 es
1918			desc "Testing arrays of arrays as function return values with implicit array size"
1919			values
1920			{
1921				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
1922				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
1923			}
1924
1925			both ""
1926				#version 320 es
1927				precision mediump int;
1928				precision mediump float;
1929				${DECLARATIONS}
1930
1931				mat3[3][3][3] func(ivec3 p)
1932				{
1933					mat3 a = mat3(	p.x, p.y, p.z,
1934									p.x, p.y, p.z,
1935									p.x, p.y, p.z);
1936					mat3 b = mat3(	p.z, p.x, -p.y,
1937									p.z, p.x, -p.y,
1938									p.z, p.x, -p.y);
1939					mat3 c = mat3(	-p.z, -p.z, p.z,
1940									-p.y, -p.y, p.y,
1941									-p.x, -p.x, p.x);
1942
1943					return mat3[][][] (	mat3[][] (	mat3[] (a, a, a),
1944													mat3[] (b, b, b),
1945													mat3[] (c, c, c)),
1946
1947										mat3[][] (	mat3[] (b, b, b),
1948													mat3[] (a, a, a),
1949													mat3[] (c, c, c)),
1950
1951										mat3[][] (	mat3[] (c, c, c),
1952													mat3[] (a, a, a),
1953													mat3[] (b, b, b)) );
1954				}
1955
1956				void main()
1957				{
1958					${SETUP}
1959
1960					mat3 x[3][3][3] = func(in0);
1961
1962					mat3 x0 = x[0][0][0];
1963					mat3 x1 = x[1][0][0];
1964					mat3 x2 = x[2][0][0];
1965
1966					float ret0 = x0[2][0];
1967					float ret1 = x1[0][2];
1968					float ret2 = x2[1][2];
1969
1970					out0 = ivec3(ret0, ret1, ret2);
1971					${OUTPUT}
1972				}
1973			""
1974		end
1975
1976		case mat3_3x4
1977			version 320 es
1978			desc "Testing arrays of arrays as function return values with implicit array size"
1979			values
1980			{
1981				input bvec3 in0 = [ bvec3(true, false, true) ];
1982				output bvec3 out0 = [ bvec3(true, false, false) ];
1983			}
1984
1985			both ""
1986				#version 320 es
1987				precision mediump float;
1988				${DECLARATIONS}
1989
1990				mat3[3][4] func(bvec3 p)
1991				{
1992					mat3 a = mat3(	p.x, p.y, p.z,
1993									p.x, p.y, p.z,
1994									p.x, p.y, p.z);
1995
1996					mat3 b = mat3(	p.z, p.x, p.y,
1997									p.z, p.x, p.y,
1998									p.z, p.x, p.y);
1999
2000					mat3 c = mat3(	p.z, p.z, p.z,
2001									p.y, p.y, p.y,
2002									p.x, p.x, p.x);
2003
2004					return mat3[][] (	mat3[] (a, b, c, a),
2005										mat3[] (b, c, a, b),
2006										mat3[] (c, a, b, c) );
2007				}
2008
2009				void main()
2010				{
2011					${SETUP}
2012
2013					mat3[4] x[3] = func(in0);
2014
2015					mat3 x0 = x[0][0];
2016					mat3 x1 = x[1][3];
2017					mat3 x2 = x[2][0];
2018
2019					float ret0 = x0[2][0];
2020					float ret1 = x1[0][2];
2021					float ret2 = x2[1][2];
2022
2023					out0 = bvec3(ret0, ret1, ret2);
2024					${OUTPUT}
2025				}
2026			""
2027		end
2028
2029	end # implicit
2030
2031end # return
2032
2033group parameter "Array of arrays as a function parameter"
2034
2035	# in
2036	group in "Array of arrays as an in-function parameter"
2037
2038		case float_3x3
2039			version 320 es
2040			desc "Testing array of arrays as an in-function parameter"
2041			values
2042			{
2043				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
2044				output vec3 out0 = [ vec3(2.0, -0.5, 1.0) | vec3(2.0, -7.4, -1.0) | vec3(-2.0, -3.0, 1.6) ];
2045			}
2046
2047			both ""
2048				#version 320 es
2049				precision mediump float;
2050				${DECLARATIONS}
2051
2052				vec3 func(in float[3][3] x)
2053				{
2054					return vec3(x[0][0], x[1][1], x[2][2]);
2055				}
2056
2057				void main()
2058				{
2059					${SETUP}
2060					float[3][3] x = float[3][3] (		float[3] (in0.z, 0.0, 0.0),
2061													float[3] (0.0, -in0.x, 0.0),
2062													float[3] (0.0, 0.0, in0.y) );
2063
2064					out0 = func(x);
2065					${OUTPUT}
2066				}
2067			""
2068		end
2069
2070		case int_2x2x2
2071			version 320 es
2072			desc "Testing array of arrays as an in-function parameter"
2073			values
2074			{
2075				input ivec2 in0 = [ ivec2(4, 1) | ivec2(7, -1) | ivec2(3, 1) ];
2076				output ivec2 out0 =	[ ivec2(1, -4) | ivec2(-1, -7) | ivec2(1, -3) ];
2077			}
2078
2079			both ""
2080				#version 320 es
2081				precision mediump int;
2082				precision mediump float;
2083				${DECLARATIONS}
2084
2085				ivec2 func(in int[2][2][2] x)
2086				{
2087					return ivec2(x[0][0][0], x[1][1][1]);
2088				}
2089
2090				void main()
2091				{
2092					${SETUP}
2093					int[2][2][2] x = int[2][2][2] (	int[2][2] (	int[2] (in0.y, -in0.x),
2094																int[2] (0, 0)),
2095													int[2][2] (	int[2] (0, 0),
2096																int[2] (in0.y, -in0.x)) );
2097
2098					out0 = func(x);
2099					${OUTPUT}
2100				}
2101			""
2102		end
2103
2104		case bool_3x2x3
2105			version 320 es
2106			desc "Testing array of arrays as an in-function parameter"
2107			values
2108			{
2109				input bvec3 in0 =		[ bvec3(false, true, true) ];
2110				output bvec3 out0 = [ bvec3(true, false, true) ];
2111			}
2112
2113			both ""
2114				#version 320 es
2115				precision mediump float;
2116				${DECLARATIONS}
2117
2118				bvec3 func(in bool x[3][2][3])
2119				{
2120					return bvec3(x[0][0][0], x[1][1][1], x[2][1][0]);
2121				}
2122
2123				void main()
2124				{
2125					${SETUP}
2126					bool[3] x[3][2] = bool[3][2][3] (	bool[2][3] (bool[3] (in0.z, in0.x, in0.y),
2127																	bool[3] (in0.x, in0.y, in0.z)),
2128														bool[2][3] (bool[3] (in0.x, in0.y, in0.z),
2129																	bool[3] (in0.z, in0.x, in0.y)),
2130														bool[2][3] (bool[3] (in0.y, in0.z, in0.x),
2131																	bool[3] (in0.y, in0.z, in0.x)) );
2132
2133					out0 = func(x);
2134					${OUTPUT}
2135				}
2136			""
2137		end
2138
2139		case vec3_2x3
2140			version 320 es
2141			desc "Testing array of arrays as an in-function parameter"
2142			values
2143			{
2144				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
2145				output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
2146			}
2147
2148			both ""
2149				#version 320 es
2150				precision mediump float;
2151				${DECLARATIONS}
2152
2153				vec3 func(in vec3[3] x[2])
2154				{
2155					return vec3(x[0][0].x, x[1][1].y, x[0][2].z);
2156				}
2157
2158				void main()
2159				{
2160					${SETUP}
2161					vec3[2][3] x = vec3[2][3](	vec3[3] (	vec3(in0.x, in0.y, -in0.z),
2162															vec3(in0.y, -in0.z, in0.x),
2163															vec3(-in0.z, in0.x, in0.y)),
2164												vec3[3] (	vec3(in0.y, -in0.z, in0.x),
2165															vec3(in0.x, in0.y, -in0.z),
2166															vec3(-in0.z, in0.x, in0.y)) );
2167
2168					x = vec3[2][3] (vec3[3] (x[0][1], x[0][2], x[0][0]),
2169									vec3[3] (x[1][1], x[1][2], x[1][0]) );
2170
2171					out0 = func(x);
2172					${OUTPUT}
2173				}
2174			""
2175		end
2176
2177		case struct_3x1x3
2178			version 320 es
2179			desc "Testing array of arrays as an in-function parameter"
2180			values
2181			{
2182				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
2183				output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
2184			}
2185
2186			both ""
2187				#version 320 es
2188				precision mediump float;
2189				${DECLARATIONS}
2190
2191				struct Test
2192				{
2193					float f;
2194					vec3 v;
2195				};
2196
2197				vec3 func(in Test[3] x[3][1])
2198				{
2199					return vec3(x[0][0][0].v.z, x[2][0][2].v.y, x[1][0][1].v.x);
2200				}
2201
2202				void main()
2203				{
2204					${SETUP}
2205					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
2206					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
2207					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
2208
2209					Test x[3][1][3] = Test[3][1][3] (	Test[1][3] (Test[3] (b, b, b)),
2210														Test[1][3] (Test[3] (a, a, a)),
2211														Test[1][3] (Test[3] (c, c, c)) );
2212
2213					out0 = func(x);
2214					${OUTPUT}
2215				}
2216			""
2217		end
2218
2219		case ivec3_3x3
2220			version 320 es
2221			desc "Testing array of arrays as an in-function parameter"
2222			values
2223			{
2224				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
2225				output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
2226			}
2227
2228			both ""
2229				#version 320 es
2230				precision mediump int;
2231				precision mediump float;
2232				${DECLARATIONS}
2233
2234				ivec3 func(in ivec3 x[3][3])
2235				{
2236					return ivec3(x[1][0].x, x[2][0].y, x[0][2].z);
2237				}
2238
2239				void main()
2240				{
2241					${SETUP}
2242					ivec3[3][3] x = ivec3[3][3] (	ivec3[3] (	ivec3(in0.x, in0.y, -in0.z),
2243																ivec3(in0.x, in0.y, -in0.z),
2244																ivec3(in0.x, in0.y, -in0.z)),
2245
2246													ivec3[3] (	ivec3(in0.y, -in0.z, in0.x),
2247																ivec3(in0.y, -in0.z, in0.x),
2248																ivec3(in0.y, -in0.z, in0.x)),
2249
2250													ivec3[3] (	ivec3(-in0.z, in0.x, in0.y),
2251																ivec3(-in0.z, in0.x, in0.y),
2252																ivec3(-in0.z, in0.x, in0.y)) );
2253
2254					out0 = func(x);
2255					${OUTPUT}
2256				}
2257			""
2258		end
2259
2260		case bvec4_4x2
2261			version 320 es
2262			desc "Testing array of arrays as an in-function parameter"
2263			values
2264			{
2265				input bvec4 in0 =		[ bvec4(true, false, false, true) ];
2266				output bvec4 out0 = [ bvec4(true, true, false, true) ];
2267			}
2268
2269			both ""
2270				#version 320 es
2271				precision mediump int;
2272				precision mediump float;
2273				${DECLARATIONS}
2274
2275				bvec4 func(in bvec4[4][2] x)
2276				{
2277					return bvec4(x[0][1].x, x[1][0].y, x[2][0].z, x[3][1].w);
2278				}
2279
2280				void main()
2281				{
2282					${SETUP}
2283					bvec4[4] a = bvec4[4](	bvec4(in0.x, in0.y, in0.z, in0.w),
2284											bvec4(in0.w, in0.y, in0.z, in0.x),
2285											bvec4(in0.z, in0.w, in0.x, in0.y),
2286											bvec4(in0.y, in0.x, in0.z, in0.w) );
2287
2288					bvec4 x[4][2] = bvec4[4][2] (	bvec4[2] (bvec4(a[0]),
2289															  bvec4(a[1])),
2290
2291													bvec4[2] (bvec4(a[2]),
2292															  bvec4(a[3])),
2293
2294													bvec4[2] (bvec4(a[1]),
2295															  bvec4(a[2])),
2296
2297													bvec4[2] (bvec4(a[3]),
2298															  bvec4(a[0])) );
2299
2300					out0 = func(x);
2301					${OUTPUT}
2302				}
2303			""
2304		end
2305
2306		case mat3_3x2
2307			version 320 es
2308			desc "Testing array of arrays as an in-function parameter"
2309			values
2310			{
2311				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
2312				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
2313			}
2314
2315			both ""
2316				#version 320 es
2317				precision mediump float;
2318				${DECLARATIONS}
2319
2320				vec3 func(in mat3[2] x[3])
2321				{
2322					mat3 a0 = x[0][0];
2323					mat3 a1 = x[0][1];
2324					mat3 a2 = x[2][1];
2325
2326					float ret0 = a0[2][0];
2327					float ret1 = a1[0][2];
2328					float ret2 = a2[1][2];
2329
2330					return vec3(ret0, ret1, ret2);
2331				}
2332
2333				void main()
2334				{
2335					${SETUP}
2336
2337					mat3 a = mat3(	in0.x, in0.y, in0.z,
2338									in0.x, in0.y, in0.z,
2339									in0.x, in0.y, in0.z);
2340
2341					mat3 b = mat3(	in0.z, in0.x, -in0.y,
2342									in0.z, in0.x, -in0.y,
2343									in0.z, in0.x, -in0.y);
2344
2345					mat3 c = mat3 (	-in0.z, -in0.z, in0.z,
2346									-in0.y, -in0.y, in0.y,
2347									-in0.x, -in0.x, in0.x);
2348
2349					mat3[3][2] x = mat3[3][2] (	mat3[2] (a, b),
2350												mat3[2] (c, a),
2351												mat3[2] (b, c) );
2352
2353					out0 = func(x);
2354					${OUTPUT}
2355				}
2356			""
2357		end
2358
2359		case mat3_3x3x3
2360			version 320 es
2361			desc "Testing array of arrays as an in-function parameter"
2362			values
2363			{
2364				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
2365				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
2366			}
2367
2368			both ""
2369				#version 320 es
2370				precision mediump int;
2371				precision mediump float;
2372				${DECLARATIONS}
2373
2374				ivec3 func(in mat3[3][3] x[3])
2375				{
2376					mat3 x0 = x[0][0][0];
2377					mat3 x1 = x[1][0][0];
2378					mat3 x2 = x[2][0][0];
2379
2380					float ret0 = x0[2][0];
2381					float ret1 = x1[0][2];
2382					float ret2 = x2[1][2];
2383
2384					return ivec3(ret0, ret1, ret2);
2385				}
2386
2387				void main()
2388				{
2389					${SETUP}
2390
2391					mat3 a = mat3(	in0.x, in0.y, in0.z,
2392									in0.x, in0.y, in0.z,
2393									in0.x, in0.y, in0.z);
2394					mat3 b = mat3(	in0.z, in0.x, -in0.y,
2395									in0.z, in0.x, -in0.y,
2396									in0.z, in0.x, -in0.y);
2397					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
2398									-in0.y, -in0.y, in0.y,
2399									-in0.x, -in0.x, in0.x);
2400
2401					mat3 x[3][3][3] = mat3[3][3][3] (	mat3[3][3] (mat3[3] (a, a, a),
2402																	mat3[3] (b, b, b),
2403																	mat3[3] (c, c, c)),
2404
2405														mat3[3][3] (mat3[3] (b, b, b),
2406																	mat3[3] (a, a, a),
2407																	mat3[3] (c, c, c)),
2408
2409														mat3[3][3] (mat3[3] (c, c, c),
2410																	mat3[3] (a, a, a),
2411																	mat3[3] (b, b, b)) );
2412
2413					out0 = func(x);
2414					${OUTPUT}
2415				}
2416			""
2417		end
2418
2419		case mat3_3x4
2420			version 320 es
2421			desc "Testing array of arrays as an in-function parameter"
2422			values
2423			{
2424				input bvec3 in0 = [ bvec3(true, false, true) ];
2425				output bvec3 out0 = [ bvec3(true, false, false) ];
2426			}
2427
2428			both ""
2429				#version 320 es
2430				precision mediump float;
2431				${DECLARATIONS}
2432
2433				bvec3 func(in mat3[4] x[3])
2434				{
2435					mat3 x0 = x[0][0];
2436					mat3 x1 = x[1][3];
2437					mat3 x2 = x[2][0];
2438
2439					float ret0 = x0[2][0];
2440					float ret1 = x1[0][2];
2441					float ret2 = x2[1][2];
2442
2443					return bvec3(ret0, ret1, ret2);
2444				}
2445
2446				void main()
2447				{
2448					${SETUP}
2449
2450					mat3 a = mat3(	in0.x, in0.y, in0.z,
2451									in0.x, in0.y, in0.z,
2452									in0.x, in0.y, in0.z);
2453
2454					mat3 b = mat3(	in0.z, in0.x, in0.y,
2455									in0.z, in0.x, in0.y,
2456									in0.z, in0.x, in0.y);
2457
2458					mat3 c = mat3(	in0.z, in0.z, in0.z,
2459									in0.y, in0.y, in0.y,
2460									in0.x, in0.x, in0.x);
2461
2462					mat3 x[3][4] = mat3[3][4] (	mat3[4] (a, b, c, a),
2463												mat3[4] (b, c, a, b),
2464												mat3[4] (c, a, b, c) );
2465
2466					out0 = func(x);
2467
2468					${OUTPUT}
2469				}
2470			""
2471		end
2472
2473	end # in
2474
2475	# out
2476	group out "Array of arrays as an out-function paramter"
2477
2478		case float_3x3
2479			version 320 es
2480			desc "Testing array of arrays as an out-function parameter"
2481			values
2482			{
2483				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
2484				output vec3 out0 = [ vec3(2.0, -0.5, 1.0) | vec3(2.0, -7.4, -1.0) | vec3(-2.0, -3.0, 1.6) ];
2485			}
2486
2487			both ""
2488				#version 320 es
2489				precision mediump float;
2490				${DECLARATIONS}
2491
2492				void func(out float[3][3] x, in vec3 p)
2493				{
2494					x = float[3][3] (		float[3] (p.z, 0.0, 0.0),
2495										float[3] (0.0, -p.x, 0.0),
2496										float[3] (0.0, 0.0, p.y) );
2497				}
2498
2499				void main()
2500				{
2501					${SETUP}
2502					float[3][3] x;
2503					func(x, in0);
2504					out0 = vec3(x[0][0], x[1][1], x[2][2]);
2505					${OUTPUT}
2506				}
2507			""
2508		end
2509
2510		case int_2x2x2
2511			version 320 es
2512			desc "Testing array of arrays as an out-function parameter"
2513			values
2514			{
2515				input ivec2 in0 = [ ivec2(4, 1) | ivec2(7, -1) | ivec2(3, 1) ];
2516				output ivec2 out0 =	[ ivec2(1, -4) | ivec2(-1, -7) | ivec2(1, -3) ];
2517			}
2518
2519			both ""
2520				#version 320 es
2521				precision mediump int;
2522				precision mediump float;
2523				${DECLARATIONS}
2524
2525				void func(out int[2][2][2] x, in ivec2 p)
2526				{
2527					x = int[2][2][2] (	int[2][2] (	int[2] (p.y, -p.x),
2528													int[2] (0, 0)),
2529										int[2][2] (	int[2] (0, 0),
2530													int[2] (p.y, -p.x)) );
2531				}
2532
2533				void main()
2534				{
2535					${SETUP}
2536					int[2][2][2] x;
2537					func(x, in0);
2538					out0 = ivec2(x[0][0][0], x[1][1][1]);
2539					${OUTPUT}
2540				}
2541			""
2542		end
2543
2544		case bool_3x2x3
2545			version 320 es
2546			desc "Testing array of arrays as an out-function parameter"
2547			values
2548			{
2549				input bvec3 in0 =		[ bvec3(false, true, true) ];
2550				output bvec3 out0 = [ bvec3(true, false, true) ];
2551			}
2552
2553			both ""
2554				#version 320 es
2555				precision mediump float;
2556				${DECLARATIONS}
2557
2558				void func(out bool x[3][2][3], in bvec3 p)
2559				{
2560					x = bool[3][2][3] (	bool[2][3] (bool[3] (p.z, p.x, p.y),
2561													bool[3] (p.x, p.y, p.z)),
2562										bool[2][3] (bool[3] (p.x, p.y, p.z),
2563													bool[3] (p.z, p.x, p.y)),
2564										bool[2][3] (bool[3] (p.y, p.z, p.x),
2565													bool[3] (p.y, p.z, p.x)) );
2566				}
2567
2568				void main()
2569				{
2570					${SETUP}
2571					bool[3] x[3][2];
2572					func(x, in0);
2573					out0 = bvec3(x[0][0][0], x[1][1][1], x[2][1][0]);
2574					${OUTPUT}
2575				}
2576			""
2577		end
2578
2579		case vec3_2x3
2580			version 320 es
2581			desc "Testing array of arrays as an out-function parameter"
2582			values
2583			{
2584				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
2585				output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
2586			}
2587
2588			both ""
2589				#version 320 es
2590				precision mediump float;
2591				${DECLARATIONS}
2592
2593				void func(out vec3[3] x[2], in vec3 p)
2594				{
2595					x = vec3[2][3](	vec3[3] (vec3(p.x, p.y, -p.z),
2596											vec3(p.y, -p.z, p.x),
2597											vec3(-p.z, p.x, p.y)),
2598									vec3[3] (vec3(p.y, -p.z, p.x),
2599											vec3(p.x, p.y, -p.z),
2600											vec3(-p.z, p.x, p.y)) );
2601
2602					x = vec3[2][3] (vec3[3] (x[0][1], x[0][2], x[0][0]),
2603									vec3[3] (x[1][1], x[1][2], x[1][0]) );
2604				}
2605
2606				void main()
2607				{
2608					${SETUP}
2609					vec3[2][3] x;
2610					func(x, in0);
2611					out0 = vec3(x[0][0].x, x[1][1].y, x[0][2].z);
2612					${OUTPUT}
2613				}
2614			""
2615		end
2616
2617		case struct_3x1x3
2618			version 320 es
2619			desc "Testing array of arrays as an out-function parameter"
2620			values
2621			{
2622				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
2623				output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
2624			}
2625
2626			both ""
2627				#version 320 es
2628				precision mediump float;
2629				${DECLARATIONS}
2630
2631				struct Test
2632				{
2633					float f;
2634					vec3 v;
2635				};
2636
2637				void func(out Test[3] x[3][1], in vec3 p)
2638				{
2639					Test a = Test(p.z, vec3(p.x, p.y, p.z));
2640					Test b = Test(p.y, vec3(-p.z, -p.x, -p.y));
2641					Test c = Test(p.x, vec3(-p.y, p.z, -p.x));
2642
2643					x = Test[3][1][3] (	Test[1][3] (Test[3] (b, b, b)),
2644										Test[1][3] (Test[3] (a, a, a)),
2645										Test[1][3] (Test[3] (c, c, c)) );
2646				}
2647
2648				void main()
2649				{
2650					${SETUP}
2651					Test x[3][1][3];
2652					func(x, in0);
2653					out0 = vec3(x[0][0][0].v.z, x[2][0][2].v.y, x[1][0][1].v.x);
2654					${OUTPUT}
2655				}
2656			""
2657		end
2658
2659		case ivec3_3x3
2660			version 320 es
2661			desc "Testing array of arrays as an out-function parameter"
2662			values
2663			{
2664				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
2665				output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
2666			}
2667
2668			both ""
2669				#version 320 es
2670				precision mediump int;
2671				precision mediump float;
2672				${DECLARATIONS}
2673
2674				void func(out ivec3 x[3][3], in ivec3 p)
2675				{
2676					x = ivec3[3][3] (ivec3[3] (	ivec3(p.x, p.y, -p.z),
2677												ivec3(p.x, p.y, -p.z),
2678												ivec3(p.x, p.y, -p.z)),
2679
2680									ivec3[3] (	ivec3(p.y, -p.z, p.x),
2681												ivec3(p.y, -p.z, p.x),
2682												ivec3(p.y, -p.z, p.x)),
2683
2684									ivec3[3] (	ivec3(-p.z, p.x, p.y),
2685												ivec3(-p.z, p.x, p.y),
2686												ivec3(-p.z, p.x, p.y)) );
2687				}
2688
2689
2690				void main()
2691				{
2692					${SETUP}
2693					ivec3[3][3] x;
2694					func(x, in0);
2695					out0 = ivec3(x[1][0].x, x[2][0].y, x[0][2].z);
2696					${OUTPUT}
2697				}
2698			""
2699		end
2700
2701		case bvec4_4x2
2702			version 320 es
2703			desc "Testing array of arrays as an out-function parameter"
2704			values
2705			{
2706				input bvec4 in0 =		[ bvec4(true, false, false, true) ];
2707				output bvec4 out0 = [ bvec4(true, true, false, true) ];
2708			}
2709
2710			both ""
2711				#version 320 es
2712				precision mediump int;
2713				precision mediump float;
2714				${DECLARATIONS}
2715
2716				void func(out bvec4[4][2] x, in bvec4 p)
2717				{
2718					bvec4[4] a = bvec4[4](	bvec4(p.x, p.y, p.z, p.w),
2719											bvec4(p.w, p.y, p.z, p.x),
2720											bvec4(p.z, p.w, p.x, p.y),
2721											bvec4(p.y, p.x, p.z, p.w) );
2722
2723					x = bvec4[4][2] (	bvec4[2] (bvec4(a[0]),
2724												  bvec4(a[1])),
2725
2726										bvec4[2] (bvec4(a[2]),
2727												  bvec4(a[3])),
2728
2729										bvec4[2] (bvec4(a[1]),
2730												  bvec4(a[2])),
2731
2732										bvec4[2] (bvec4(a[3]),
2733												  bvec4(a[0])) );
2734				}
2735
2736				void main()
2737				{
2738					${SETUP}
2739					bvec4 x[4][2];
2740					func(x, in0);
2741					out0 = bvec4(x[0][1].x, x[1][0].y, x[2][0].z, x[3][1].w);
2742					${OUTPUT}
2743				}
2744			""
2745		end
2746
2747		case mat3_3x2
2748			version 320 es
2749			desc "Testing array of arrays as an out-function parameter"
2750			values
2751			{
2752				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
2753				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
2754			}
2755
2756			both ""
2757				#version 320 es
2758				precision mediump float;
2759				${DECLARATIONS}
2760
2761				void func(out mat3[2] x[3], in vec3 p)
2762				{
2763					mat3 a = mat3(	p.x, p.y, p.z,
2764									p.x, p.y, p.z,
2765									p.x, p.y, p.z);
2766
2767					mat3 b = mat3(	p.z, p.x, -p.y,
2768									p.z, p.x, -p.y,
2769									p.z, p.x, -p.y);
2770
2771					mat3 c = mat3 (	-p.z, -p.z, p.z,
2772									-p.y, -p.y, p.y,
2773									-p.x, -p.x, p.x);
2774
2775					x = mat3[3][2] (mat3[2] (a, b),
2776									mat3[2] (c, a),
2777									mat3[2] (b, c) );
2778				}
2779
2780				void main()
2781				{
2782					${SETUP}
2783
2784					mat3[3][2] x;
2785					func(x, in0);
2786
2787					mat3 a0 = x[0][0];
2788					mat3 a1 = x[0][1];
2789					mat3 a2 = x[2][1];
2790
2791					float ret0 = a0[2][0];
2792					float ret1 = a1[0][2];
2793					float ret2 = a2[1][2];
2794
2795					out0 = vec3(ret0, ret1, ret2);
2796
2797					${OUTPUT}
2798				}
2799			""
2800		end
2801
2802		case mat3_3x3x3
2803			version 320 es
2804			desc "Testing array of arrays as an out-function parameter"
2805			values
2806			{
2807				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
2808				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
2809			}
2810
2811			both ""
2812				#version 320 es
2813				precision mediump int;
2814				precision mediump float;
2815				${DECLARATIONS}
2816
2817				void func(out mat3[3] x[3][3], in ivec3 p)
2818				{
2819					mat3 a = mat3(	p.x, p.y, p.z,
2820									p.x, p.y, p.z,
2821									p.x, p.y, p.z);
2822					mat3 b = mat3(	p.z, p.x, -p.y,
2823									p.z, p.x, -p.y,
2824									p.z, p.x, -p.y);
2825					mat3 c = mat3(	-p.z, -p.z, p.z,
2826									-p.y, -p.y, p.y,
2827									-p.x, -p.x, p.x);
2828
2829					x = mat3[3][3][3] (	mat3[3][3] (mat3[3] (a, a, a),
2830													mat3[3] (b, b, b),
2831													mat3[3] (c, c, c)),
2832
2833										mat3[3][3] (mat3[3] (b, b, b),
2834													mat3[3] (a, a, a),
2835													mat3[3] (c, c, c)),
2836
2837										mat3[3][3] (mat3[3] (c, c, c),
2838													mat3[3] (a, a, a),
2839													mat3[3] (b, b, b)) );
2840				}
2841
2842				void main()
2843				{
2844					${SETUP}
2845
2846					mat3 x[3][3][3];
2847					func(x, in0);
2848
2849					mat3 x0 = x[0][0][0];
2850					mat3 x1 = x[1][0][0];
2851					mat3 x2 = x[2][0][0];
2852
2853					float ret0 = x0[2][0];
2854					float ret1 = x1[0][2];
2855					float ret2 = x2[1][2];
2856
2857					out0 = ivec3(ret0, ret1, ret2);
2858
2859					${OUTPUT}
2860				}
2861			""
2862		end
2863
2864		case mat3_3x4
2865			version 320 es
2866			desc "Testing array of arrays as an out-function parameter"
2867			values
2868			{
2869				input bvec3 in0 = [ bvec3(true, false, true) ];
2870				output bvec3 out0 = [ bvec3(true, false, false) ];
2871			}
2872
2873			both ""
2874				#version 320 es
2875				precision mediump float;
2876				${DECLARATIONS}
2877
2878				void func(out mat3[4] x[3], in bvec3 p)
2879				{
2880					mat3 a = mat3(	p.x, p.y, p.z,
2881									p.x, p.y, p.z,
2882									p.x, p.y, p.z);
2883
2884					mat3 b = mat3(	p.z, p.x, p.y,
2885									p.z, p.x, p.y,
2886									p.z, p.x, p.y);
2887
2888					mat3 c = mat3(	p.z, p.z, p.z,
2889									p.y, p.y, p.y,
2890									p.x, p.x, p.x);
2891
2892					x = mat3[3][4] (mat3[4] (a, b, c, a),
2893									mat3[4] (b, c, a, b),
2894									mat3[4] (c, a, b, c) );
2895				}
2896
2897				void main()
2898				{
2899					${SETUP}
2900
2901					mat3 x[3][4];
2902					func(x, in0);
2903
2904					mat3 x0 = x[0][0];
2905					mat3 x1 = x[1][3];
2906					mat3 x2 = x[2][0];
2907
2908					float ret0 = x0[2][0];
2909					float ret1 = x1[0][2];
2910					float ret2 = x2[1][2];
2911
2912					out0 = bvec3(ret0, ret1, ret2);
2913
2914					${OUTPUT}
2915				}
2916			""
2917		end
2918
2919	end # out
2920
2921	group unnamed "Array of arrays as unnamed parameter of a function prototype"
2922
2923		case float_3x3
2924			version 320 es
2925			desc "Testing array of arrays as unnamed parameter of a function prototype"
2926			values
2927			{
2928				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
2929				output vec3 out0 = [ vec3(2.0, -0.5, 1.0) | vec3(2.0, -7.4, -1.0) | vec3(-2.0, -3.0, 1.6) ];
2930			}
2931
2932			both ""
2933				#version 320 es
2934				precision mediump float;
2935				${DECLARATIONS}
2936
2937				vec3 func(in float[3][3]);
2938
2939				void main()
2940				{
2941					${SETUP}
2942					float[3][3] x = float[3][3] (	float[3] (in0.z, 0.0, 0.0),
2943													float[3] (0.0, -in0.x, 0.0),
2944													float[3] (0.0, 0.0, in0.y) );
2945					out0 = func(x);
2946					${OUTPUT}
2947				}
2948
2949				vec3 func(in float[3][3] x)
2950				{
2951					return vec3(x[0][0], x[1][1], x[2][2]);
2952				}
2953			""
2954		end
2955
2956		case int_2x2x2
2957			version 320 es
2958			desc "Testing array of arrays as unnamed parameter of a function prototype"
2959			values
2960			{
2961				input ivec2 in0 = [ ivec2(4, 1) | ivec2(7, -1) | ivec2(3, 1) ];
2962				output ivec2 out0 =	[ ivec2(1, -4) | ivec2(-1, -7) | ivec2(1, -3) ];
2963			}
2964
2965			both ""
2966				#version 320 es
2967				precision mediump int;
2968				precision mediump float;
2969				${DECLARATIONS}
2970
2971				ivec2 func(in int[2][2][2]);
2972
2973				void main()
2974				{
2975					${SETUP}
2976					int[2][2][2] x = int[2][2][2] (	int[2][2] (	int[2] (in0.y, -in0.x),
2977																int[2] (0, 0)),
2978													int[2][2] (	int[2] (0, 0),
2979																int[2] (in0.y, -in0.x)) );
2980					out0 = func(x);
2981					${OUTPUT}
2982				}
2983
2984				ivec2 func(in int[2][2][2] x)
2985				{
2986					return ivec2(x[0][0][0], x[1][1][1]);
2987				}
2988
2989			""
2990		end
2991
2992		case bool_3x2x3
2993			version 320 es
2994			desc "Testing array of arrays as unnamed parameter of a function prototype"
2995			values
2996			{
2997				input bvec3 in0 =		[ bvec3(false, true, true) ];
2998				output bvec3 out0 = [ bvec3(true, false, true) ];
2999			}
3000
3001			both ""
3002				#version 320 es
3003				precision mediump float;
3004				${DECLARATIONS}
3005
3006				bvec3 func(in bool[3][2][3]);
3007
3008				void main()
3009				{
3010					${SETUP}
3011					bool[3] x[3][2] = bool[3][2][3] (	bool[2][3] (bool[3] (in0.z, in0.x, in0.y),
3012																	bool[3] (in0.x, in0.y, in0.z)),
3013														bool[2][3] (bool[3] (in0.x, in0.y, in0.z),
3014																	bool[3] (in0.z, in0.x, in0.y)),
3015														bool[2][3] (bool[3] (in0.y, in0.z, in0.x),
3016																	bool[3] (in0.y, in0.z, in0.x)) );
3017					out0 = func(x);
3018					${OUTPUT}
3019				}
3020
3021				bvec3 func(in bool x[3][2][3])
3022				{
3023					return bvec3(x[0][0][0], x[1][1][1], x[2][1][0]);
3024				}
3025			""
3026		end
3027
3028		case vec3_2x3
3029			version 320 es
3030			desc "Testing array of arrays as unnamed parameter of a function prototype"
3031			values
3032			{
3033				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
3034				output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
3035			}
3036
3037			both ""
3038				#version 320 es
3039				precision mediump float;
3040				${DECLARATIONS}
3041
3042				vec3 func(in vec3[2][3]);
3043
3044				void main()
3045				{
3046					${SETUP}
3047					vec3[2][3] x = vec3[2][3](	vec3[3] (	vec3(in0.x, in0.y, -in0.z),
3048															vec3(in0.y, -in0.z, in0.x),
3049															vec3(-in0.z, in0.x, in0.y)),
3050												vec3[3] (	vec3(in0.y, -in0.z, in0.x),
3051															vec3(in0.x, in0.y, -in0.z),
3052															vec3(-in0.z, in0.x, in0.y)) );
3053
3054					x = vec3[2][3] (vec3[3] (x[0][1], x[0][2], x[0][0]),
3055									vec3[3] (x[1][1], x[1][2], x[1][0]) );
3056					out0 = func(x);
3057					${OUTPUT}
3058				}
3059
3060				vec3 func(in vec3[3] x[2])
3061				{
3062					return vec3(x[0][0].x, x[1][1].y, x[0][2].z);
3063				}
3064			""
3065		end
3066
3067		case struct_3x1x3
3068			version 320 es
3069			desc "Testing array of arrays as unnamed parameter of a function prototype"
3070			values
3071			{
3072				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
3073				output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
3074			}
3075
3076			both ""
3077				#version 320 es
3078				precision mediump float;
3079				${DECLARATIONS}
3080
3081				struct Test
3082				{
3083					float f;
3084					vec3 v;
3085				};
3086
3087				vec3 func(in Test[3] x[3][1])
3088				{
3089					return vec3(x[0][0][0].v.z, x[2][0][2].v.y, x[1][0][1].v.x);
3090				}
3091
3092				void main()
3093				{
3094					${SETUP}
3095					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
3096					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
3097					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
3098
3099					Test x[3][1][3] = Test[3][1][3] (	Test[1][3] (Test[3] (b, b, b)),
3100														Test[1][3] (Test[3] (a, a, a)),
3101														Test[1][3] (Test[3] (c, c, c)) );
3102
3103					out0 = func(x);
3104					${OUTPUT}
3105				}
3106			""
3107		end
3108
3109		case ivec3_3x3
3110			version 320 es
3111			desc "Testing array of arrays as unnamed parameter of a function prototype"
3112			values
3113			{
3114				input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
3115				output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
3116			}
3117
3118			both ""
3119				#version 320 es
3120				precision mediump int;
3121				precision mediump float;
3122				${DECLARATIONS}
3123
3124				ivec3 func(in ivec3[3][3]);
3125
3126				void main()
3127				{
3128					${SETUP}
3129					ivec3[3][3] x = ivec3[3][3] (	ivec3[3] (	ivec3(in0.x, in0.y, -in0.z),
3130																ivec3(in0.x, in0.y, -in0.z),
3131																ivec3(in0.x, in0.y, -in0.z)),
3132
3133													ivec3[3] (	ivec3(in0.y, -in0.z, in0.x),
3134																ivec3(in0.y, -in0.z, in0.x),
3135																ivec3(in0.y, -in0.z, in0.x)),
3136
3137													ivec3[3] (	ivec3(-in0.z, in0.x, in0.y),
3138																ivec3(-in0.z, in0.x, in0.y),
3139																ivec3(-in0.z, in0.x, in0.y)) );
3140					out0 = func(x);
3141					${OUTPUT}
3142				}
3143
3144				ivec3 func(in ivec3 x[3][3])
3145				{
3146					return ivec3(x[1][0].x, x[2][0].y, x[0][2].z);
3147				}
3148
3149			""
3150		end
3151
3152		case bvec4_4x2
3153			version 320 es
3154			desc "Testing array of arrays as unnamed parameter of a function prototype"
3155			values
3156			{
3157				input bvec4 in0 =		[ bvec4(true, false, false, true) ];
3158				output bvec4 out0 = [ bvec4(true, true, false, true) ];
3159			}
3160
3161			both ""
3162				#version 320 es
3163				precision mediump int;
3164				precision mediump float;
3165				${DECLARATIONS}
3166
3167				bvec4 func(in bvec4[4][2]);
3168
3169				void main()
3170				{
3171					${SETUP}
3172					bvec4[4] a = bvec4[4](	bvec4(in0.x, in0.y, in0.z, in0.w),
3173											bvec4(in0.w, in0.y, in0.z, in0.x),
3174											bvec4(in0.z, in0.w, in0.x, in0.y),
3175											bvec4(in0.y, in0.x, in0.z, in0.w) );
3176
3177					bvec4 x[4][2] = bvec4[4][2] (	bvec4[2] (bvec4(a[0]),
3178															  bvec4(a[1])),
3179
3180													bvec4[2] (bvec4(a[2]),
3181															  bvec4(a[3])),
3182
3183													bvec4[2] (bvec4(a[1]),
3184															  bvec4(a[2])),
3185
3186													bvec4[2] (bvec4(a[3]),
3187															  bvec4(a[0])) );
3188
3189					out0 = func(x);
3190					${OUTPUT}
3191				}
3192
3193				bvec4 func(in bvec4[4][2] x)
3194				{
3195					return bvec4(x[0][1].x, x[1][0].y, x[2][0].z, x[3][1].w);
3196				}
3197			""
3198		end
3199
3200		case mat3_3x2
3201			version 320 es
3202			desc "Testing array of arrays as unnamed parameter of a function prototype"
3203			values
3204			{
3205				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
3206				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
3207			}
3208
3209			both ""
3210				#version 320 es
3211				precision mediump float;
3212				${DECLARATIONS}
3213
3214				vec3 func(in mat3[3][2]);
3215
3216				void main()
3217				{
3218					${SETUP}
3219
3220					mat3 a = mat3(	in0.x, in0.y, in0.z,
3221									in0.x, in0.y, in0.z,
3222									in0.x, in0.y, in0.z);
3223
3224					mat3 b = mat3(	in0.z, in0.x, -in0.y,
3225									in0.z, in0.x, -in0.y,
3226									in0.z, in0.x, -in0.y);
3227
3228					mat3 c = mat3 (	-in0.z, -in0.z, in0.z,
3229									-in0.y, -in0.y, in0.y,
3230									-in0.x, -in0.x, in0.x);
3231
3232					mat3[3][2] x = mat3[3][2] (	mat3[2] (a, b),
3233												mat3[2] (c, a),
3234												mat3[2] (b, c) );
3235
3236					out0 = func(x);
3237					${OUTPUT}
3238				}
3239
3240				vec3 func(in mat3[2] x[3])
3241				{
3242					mat3 a0 = x[0][0];
3243					mat3 a1 = x[0][1];
3244					mat3 a2 = x[2][1];
3245
3246					float ret0 = a0[2][0];
3247					float ret1 = a1[0][2];
3248					float ret2 = a2[1][2];
3249
3250					return vec3(ret0, ret1, ret2);
3251				}
3252			""
3253		end
3254
3255		case mat3_3x3x3
3256			version 320 es
3257			desc "Testing array of arrays as unnamed parameter of a function prototype"
3258			values
3259			{
3260				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
3261				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
3262			}
3263
3264			both ""
3265				#version 320 es
3266				precision mediump int;
3267				precision mediump float;
3268				${DECLARATIONS}
3269
3270				ivec3 func(in mat3[3][3][3]);
3271
3272				void main()
3273				{
3274					${SETUP}
3275
3276					mat3 a = mat3(	in0.x, in0.y, in0.z,
3277									in0.x, in0.y, in0.z,
3278									in0.x, in0.y, in0.z);
3279					mat3 b = mat3(	in0.z, in0.x, -in0.y,
3280									in0.z, in0.x, -in0.y,
3281									in0.z, in0.x, -in0.y);
3282					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
3283									-in0.y, -in0.y, in0.y,
3284									-in0.x, -in0.x, in0.x);
3285
3286					mat3 x[3][3][3] = mat3[3][3][3] (mat3[3][3] (mat3[3] (a, a, a),
3287																mat3[3] (b, b, b),
3288																mat3[3] (c, c, c)),
3289
3290													mat3[3][3] (mat3[3] (b, b, b),
3291																mat3[3] (a, a, a),
3292																mat3[3] (c, c, c)),
3293
3294													mat3[3][3] (mat3[3] (c, c, c),
3295																mat3[3] (a, a, a),
3296																mat3[3] (b, b, b)) );
3297
3298					out0 = func(x);
3299					${OUTPUT}
3300				}
3301
3302				ivec3 func(in mat3[3][3] x[3])
3303				{
3304					mat3 x0 = x[0][0][0];
3305					mat3 x1 = x[1][0][0];
3306					mat3 x2 = x[2][0][0];
3307
3308					float ret0 = x0[2][0];
3309					float ret1 = x1[0][2];
3310					float ret2 = x2[1][2];
3311
3312					return ivec3(ret0, ret1, ret2);
3313				}
3314			""
3315		end
3316
3317		case mat3_3x4
3318			version 320 es
3319			desc "Testing array of arrays as unnamed parameter of a function prototype"
3320			values
3321			{
3322				input bvec3 in0 = [ bvec3(true, false, true) ];
3323				output bvec3 out0 = [ bvec3(true, false, false) ];
3324			}
3325
3326			both ""
3327				#version 320 es
3328				precision mediump float;
3329				${DECLARATIONS}
3330
3331				bvec3 func(in mat3[3][4]);
3332
3333				void main()
3334				{
3335					${SETUP}
3336
3337					mat3 a = mat3(	in0.x, in0.y, in0.z,
3338									in0.x, in0.y, in0.z,
3339									in0.x, in0.y, in0.z);
3340
3341					mat3 b = mat3(	in0.z, in0.x, in0.y,
3342									in0.z, in0.x, in0.y,
3343									in0.z, in0.x, in0.y);
3344
3345					mat3 c = mat3(	in0.z, in0.z, in0.z,
3346									in0.y, in0.y, in0.y,
3347									in0.x, in0.x, in0.x);
3348
3349					mat3 x[3][4] = mat3[3][4] (	mat3[4] (a, b, c, a),
3350												mat3[4] (b, c, a, b),
3351												mat3[4] (c, a, b, c) );
3352
3353					out0 = func(x);
3354
3355					${OUTPUT}
3356				}
3357
3358				bvec3 func(in mat3[4] x[3])
3359				{
3360					mat3 x0 = x[0][0];
3361					mat3 x1 = x[1][3];
3362					mat3 x2 = x[2][0];
3363
3364					float ret0 = x0[2][0];
3365					float ret1 = x1[0][2];
3366					float ret2 = x2[1][2];
3367
3368					return bvec3(ret0, ret1, ret2);
3369				}
3370			""
3371		end
3372
3373	end # unnamed_parameter
3374
3375end # parameter
3376
3377group implicit_size "Declaring arrays of arrays with implicit size"
3378
3379	case float_3x3
3380		version 320 es
3381		desc "Testing declaring arrays of arrays with implicit size"
3382		values
3383		{
3384			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
3385			output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
3386		}
3387
3388		both ""
3389			#version 320 es
3390			precision mediump float;
3391			${DECLARATIONS}
3392
3393			void main()
3394			{
3395				${SETUP}
3396				float x[][] = float[][] (		float[] (in0.z, in0.x, in0.y),
3397											float[] (in0.z, in0.x, in0.y),
3398											float[] (in0.z, in0.x, in0.y) );
3399
3400				out0 = vec3(x[0][0], x[1][1], x[2][2]);
3401				${OUTPUT}
3402			}
3403		""
3404	end
3405
3406	case int_2x3
3407		version 320 es
3408		desc "Testing declaring arrays of arrays with implicit size"
3409		values
3410		{
3411			input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
3412			output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
3413		}
3414
3415		both ""
3416			#version 320 es
3417			precision mediump int;
3418			precision mediump float;
3419			${DECLARATIONS}
3420
3421			void main()
3422			{
3423				${SETUP}
3424				int[][] x = int[][] (		int[] (in0.z, in0.x, in0.y),
3425										int[] (in0.z, in0.x, in0.y) );;
3426
3427				out0 = ivec3(x[0][0], x[1][1], x[0][2]);
3428				${OUTPUT}
3429			}
3430		""
3431	end
3432
3433	case bool_3x3x3
3434		version 320 es
3435		desc "Testing declaring arrays of arrays with implicit size"
3436		values
3437		{
3438			input bvec3 in0 = [ bvec3(false, true, true) ];
3439			output bvec3 out0 = [ bvec3(true, false, true) ];
3440		}
3441
3442		both ""
3443			#version 320 es
3444			precision mediump float;
3445			${DECLARATIONS}
3446
3447			void main()
3448			{
3449				${SETUP}
3450				bool[][] x[] = bool[][][] ( bool[][] (	bool[](in0.z, in0.z, in0.z),
3451														bool[](in0.z, in0.z, in0.z),
3452														bool[](in0.z, in0.z, in0.z)),
3453
3454											bool[][] (	bool[](in0.x, in0.x, in0.x),
3455														bool[](in0.x, in0.x, in0.x),
3456														bool[](in0.x, in0.x, in0.x)),
3457
3458											bool[][] (	bool[](in0.y, in0.y, in0.y),
3459														bool[](in0.y, in0.y, in0.y),
3460														bool[](in0.y, in0.y, in0.y)) );
3461
3462				out0 = bvec3(x[0][0][0], x[1][1][1], x[2][2][2]);
3463				${OUTPUT}
3464			}
3465		""
3466	end
3467
3468	case struct_5x5x4
3469		version 320 es
3470		desc "Testing declaring arrays of arrays with implicit size"
3471		values
3472		{
3473			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
3474			output vec3 out0 = [ vec3(-1.0, -0.5, 2.0) ];
3475		}
3476
3477		both ""
3478			#version 320 es
3479			precision mediump float;
3480			${DECLARATIONS}
3481
3482			struct Test
3483			{
3484				float f;
3485				vec3 v;
3486			};
3487
3488			void main()
3489			{
3490				${SETUP}
3491
3492				Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
3493				Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
3494				Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
3495
3496				Test[] x[][] = Test[][][] (	Test[][] (	Test[] (c, c, c, c),
3497														Test[] (b, b, b, b),
3498														Test[] (a, a, a, a),
3499														Test[] (c, c, c, c),
3500														Test[] (b, b, b, b) ),
3501
3502											Test[][] (	Test[] (a, a, a, a),
3503														Test[] (b, b, b, b),
3504														Test[] (c, c, c, c),
3505														Test[] (a, a, a, a),
3506														Test[] (b, b, b, b) ),
3507
3508											Test[][] (	Test[] (b, b, b, b),
3509														Test[] (c, c, c, c),
3510														Test[] (a, a, a, a),
3511														Test[] (b, b, b, b),
3512														Test[] (c, c, c, c) ),
3513
3514											Test[][] (	Test[] (c, c, c, c),
3515														Test[] (b, b, b, b),
3516														Test[] (a, a, a, a),
3517														Test[] (c, c, c, c),
3518														Test[] (b, b, b, b) ),
3519
3520											Test[][] (	Test[] (a, a, a, a),
3521														Test[] (b, b, b, b),
3522														Test[] (c, c, c, c),
3523														Test[] (a, a, a, a),
3524														Test[] (b, b, b, b) ) );
3525
3526				out0 = vec3(x[0][0][0].v.x, x[1][1][1].v.y, x[4][3][3].v.z);
3527				${OUTPUT}
3528			}
3529		""
3530	end
3531
3532	case vec3_1x3
3533		version 320 es
3534		desc "Testing declaring arrays of arrays with implicit size"
3535		values
3536		{
3537			input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
3538			output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(-0.5, 1.0, 11.2) ];
3539		}
3540
3541		both ""
3542			#version 320 es
3543			precision mediump float;
3544			${DECLARATIONS}
3545
3546			void main()
3547			{
3548				${SETUP}
3549				vec3 x[][] = vec3[][] (	vec3[] (vec3(in0.x, in0.y, -in0.z)	,
3550												vec3(in0.y, -in0.z, in0.x)	,
3551												vec3(-in0.z, in0.x, in0.y)) );
3552
3553				out0 = vec3(x[0][0].x, x[0][1].y, x[0][2].z);
3554				${OUTPUT}
3555			}
3556		""
3557	end
3558
3559	case ivec3_3x1x3
3560		version 320 es
3561		desc "Testing declaring arrays of arrays with implicit size"
3562		values
3563		{
3564			input ivec3 in0 =		[ ivec3(0, 1, 2) | ivec3(5, 11, -1) ];
3565			output ivec3 out0 = [ ivec3(0, -2, 1) | ivec3(5, 1, 11) ];
3566		}
3567
3568		both ""
3569			#version 320 es
3570			precision mediump int;
3571			precision mediump float;
3572			${DECLARATIONS}
3573
3574			void main()
3575			{
3576				${SETUP}
3577				ivec3[][][] x = ivec3[][][] (	ivec3[][] (	ivec3[] (	ivec3(in0.x, in0.y, -in0.z),
3578																		ivec3(0.0, 0.0, 0.0),
3579																		ivec3(0.0, 0.0, 0.0)) ),
3580
3581												ivec3[][] ( ivec3[] (	ivec3(0.0, 0.0, 0.0),
3582																		ivec3(in0.y, -in0.z, in0.x),
3583																		ivec3(0.0, 0.0, 0.0)) ),
3584
3585												ivec3[][] (	ivec3[] (	ivec3(0.0, 0.0, 0.0),
3586																		ivec3(0.0, 0.0, 0.0),
3587																		ivec3(-in0.z, in0.x, in0.y)) ) );
3588
3589				out0 = ivec3(x[0][0][0].x, x[1][0][1].y, x[2][0][2].z);
3590				${OUTPUT}
3591			}
3592		""
3593	end
3594
3595	case bvec3_3x1
3596		version 320 es
3597		desc "Testing declaring arrays of arrays with implicit size"
3598		values
3599		{
3600			input bvec3 in0 =		[ bvec3(true, false, true) ];
3601			output bvec3 out0 = [ bvec3(true, true, false) ];
3602		}
3603
3604		both ""
3605			#version 320 es
3606			precision mediump float;
3607			${DECLARATIONS}
3608
3609			void main()
3610			{
3611				${SETUP}
3612				bvec3[][] x = bvec3[][] (	bvec3[] ( bvec3(in0.x, in0.y, in0.z)),
3613											bvec3[] ( bvec3(in0.y, in0.z, in0.x)),
3614											bvec3[] ( bvec3(in0.z, in0.x, in0.y)) );
3615
3616				out0 = bvec3(x[0][0].x, x[1][0].y, x[2][0].z);
3617				${OUTPUT}
3618			}
3619		""
3620	end
3621
3622	case mat3_3x2
3623		version 320 es
3624		desc "Testing declaring arrays of arrays with implicit size"
3625		values
3626		{
3627			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
3628			output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
3629		}
3630
3631		both ""
3632			#version 320 es
3633			precision mediump float;
3634			${DECLARATIONS}
3635
3636			void main()
3637			{
3638				${SETUP}
3639				mat3[][] a = mat3[][] (	mat3[] ( mat3(	in0.x, in0.y, in0.z,
3640														in0.x, in0.y, in0.z,
3641														in0.x, in0.y, in0.z),
3642												 mat3(	in0.z, in0.x, -in0.y,
3643														in0.z, in0.x, -in0.y,
3644														in0.z, in0.x, -in0.y)),
3645
3646										mat3[] ( mat3(	-in0.z, -in0.z, in0.z,
3647														-in0.y, -in0.y, in0.y,
3648														-in0.x, -in0.x, in0.x),
3649												 mat3(	in0.x, in0.y, in0.z,
3650														in0.x, in0.y, in0.z,
3651														in0.x, in0.y, in0.z)),
3652
3653										mat3[] ( mat3(	in0.z, in0.x, -in0.y,
3654														in0.z, in0.x, -in0.y,
3655														in0.z, in0.x, -in0.y),
3656												 mat3(	-in0.z, -in0.z, in0.z,
3657														-in0.y, -in0.y, in0.y,
3658														-in0.x, -in0.x, in0.x)) );
3659
3660				mat3 a0 = a[0][0];
3661				mat3 a1 = a[0][1];
3662				mat3 a2 = a[2][1];
3663
3664				float ret0 = a0[2][0];
3665				float ret1 = a1[0][2];
3666				float ret2 = a2[1][2];
3667
3668				out0 = vec3(ret0, ret1, ret2);
3669				${OUTPUT}
3670			}
3671		""
3672	end
3673
3674	case mat3_3x3x3
3675		version 320 es
3676		desc "Testing declaring arrays of arrays with implicit size"
3677		values
3678		{
3679			input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
3680			output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
3681		}
3682
3683		both ""
3684			#version 320 es
3685			precision mediump int;
3686			precision mediump float;
3687			${DECLARATIONS}
3688
3689			void main()
3690			{
3691				${SETUP}
3692
3693				mat3 a = mat3(	in0.x, in0.y, in0.z,
3694								in0.x, in0.y, in0.z,
3695								in0.x, in0.y, in0.z);
3696				mat3 b = mat3(	in0.z, in0.x, -in0.y,
3697								in0.z, in0.x, -in0.y,
3698								in0.z, in0.x, -in0.y);
3699				mat3 c = mat3(	-in0.z, -in0.z, in0.z,
3700								-in0.y, -in0.y, in0.y,
3701								-in0.x, -in0.x, in0.x);
3702
3703				mat3[][][] x = mat3[][][] (	mat3[][] (		mat3[] (a, a, a),
3704														mat3[] (b, b, b),
3705														mat3[] (c, c, c)),
3706
3707											mat3[][] (		mat3[] (b, b, b),
3708														mat3[] (a, a, a),
3709														mat3[] (c, c, c)),
3710
3711											mat3[][] (		mat3[] (c, c, c),
3712														mat3[] (a, a, a),
3713														mat3[] (b, b, b)) );
3714
3715				mat3 x0 = x[0][0][0];
3716				mat3 x1 = x[1][0][0];
3717				mat3 x2 = x[2][0][0];
3718
3719				float ret0 = x0[2][0];
3720				float ret1 = x1[0][2];
3721				float ret2 = x2[1][2];
3722
3723				out0 = ivec3(ret0, ret1, ret2);
3724				${OUTPUT}
3725			}
3726		""
3727	end
3728
3729	case mat3_3x4
3730		version 320 es
3731		desc "Testing declaring arrays of arrays with implicit size"
3732		values
3733		{
3734			input bvec3 in0 = [ bvec3(true, false, true) ];
3735			output bvec3 out0 = [ bvec3(true, false, false) ];
3736		}
3737
3738		both ""
3739			#version 320 es
3740			precision mediump float;
3741			${DECLARATIONS}
3742
3743			void main()
3744			{
3745				${SETUP}
3746
3747				mat3 a = mat3(	in0.x, in0.y, in0.z,
3748								in0.x, in0.y, in0.z,
3749								in0.x, in0.y, in0.z);
3750
3751				mat3 b = mat3(	in0.z, in0.x, in0.y,
3752								in0.z, in0.x, in0.y,
3753								in0.z, in0.x, in0.y);
3754
3755				mat3 c = mat3(	in0.z, in0.z, in0.z,
3756								in0.y, in0.y, in0.y,
3757								in0.x, in0.x, in0.x);
3758
3759				mat3[] x[] = mat3[][] (	mat3[] (a, b, c, a),
3760										mat3[] (b, c, a, b),
3761										mat3[] (c, a, b, c) );
3762
3763				mat3 x0 = x[0][0];
3764				mat3 x1 = x[1][3];
3765				mat3 x2 = x[2][0];
3766
3767				float ret0 = x0[2][0];
3768				float ret1 = x1[0][2];
3769				float ret2 = x2[1][2];
3770
3771				out0 = bvec3(ret0, ret1, ret2);
3772				${OUTPUT}
3773			}
3774		""
3775	end
3776
3777end # implicit_size
3778
3779group assignment "Testing assignment of arrays of arrays"
3780
3781	group explicit_to_explicit "Declaring an array of arrays with explicit size and assigning it to another array of arrays with explicit size"
3782
3783		case float_3x3
3784			version 320 es
3785			desc "Testing assignment of arrays of arrays with explicit size"
3786			values
3787			{
3788				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
3789				output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
3790			}
3791
3792			both ""
3793				#version 320 es
3794				precision mediump float;
3795				${DECLARATIONS}
3796
3797				void main()
3798				{
3799					${SETUP}
3800					float x[3][3] = float[3][3] (		float[3] (in0.z, in0.x, in0.y),
3801													float[3] (in0.z, in0.x, in0.y),
3802													float[3] (in0.z, in0.x, in0.y) );
3803
3804					float[3] y[3] = x;
3805
3806					out0 = vec3(y[0][0], y[1][1], y[2][2]);
3807					${OUTPUT}
3808				}
3809			""
3810		end
3811
3812		case int_2x3
3813			version 320 es
3814			desc "Testing assignment of arrays of arrays with explicit size"
3815			values
3816			{
3817				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
3818				output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
3819			}
3820
3821			both ""
3822				#version 320 es
3823				precision mediump int;
3824				precision mediump float;
3825				${DECLARATIONS}
3826
3827				void main()
3828				{
3829					${SETUP}
3830					int[2][3] x = int[2][3] (	int[3] (in0.z, in0.x, in0.y),
3831												int[3] (in0.z, in0.x, in0.y) );;
3832					int y[2][3] = x;
3833
3834					out0 = ivec3(y[0][0], y[1][1], y[0][2]);
3835					${OUTPUT}
3836				}
3837			""
3838		end
3839
3840		case bool_3x3x3
3841			version 320 es
3842			desc "Testing assignment of arrays of arrays with explicit size"
3843			values
3844			{
3845				input bvec3 in0 = [ bvec3(false, true, true) ];
3846				output bvec3 out0 = [ bvec3(true, false, true) ];
3847			}
3848
3849			both ""
3850				#version 320 es
3851				precision mediump float;
3852				${DECLARATIONS}
3853
3854				void main()
3855				{
3856					${SETUP}
3857					bool[3][3] x[3] = bool[3][3][3] (bool[3][3] (bool[3](in0.z, in0.z, in0.z),
3858																bool[3](in0.z, in0.z, in0.z),
3859																bool[3](in0.z, in0.z, in0.z)),
3860
3861													bool[3][3] (bool[3](in0.x, in0.x, in0.x),
3862																bool[3](in0.x, in0.x, in0.x),
3863																bool[3](in0.x, in0.x, in0.x)),
3864
3865													bool[3][3] (bool[3](in0.y, in0.y, in0.y),
3866																bool[3](in0.y, in0.y, in0.y),
3867																bool[3](in0.y, in0.y, in0.y)) );
3868
3869					bool[3] y[3][3] = x;
3870
3871					out0 = bvec3(y[0][0][0], y[1][1][1], y[2][2][2]);
3872					${OUTPUT}
3873				}
3874			""
3875		end
3876
3877		case struct_5x5x4
3878			version 320 es
3879			desc "Testing assignment of arrays of arrays with explicit size"
3880			values
3881			{
3882				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
3883				output vec3 out0 = [ vec3(-1.0, -0.5, 2.0) ];
3884			}
3885
3886			both ""
3887				#version 320 es
3888				precision mediump float;
3889				${DECLARATIONS}
3890
3891				struct Test
3892				{
3893					float f;
3894					vec3 v;
3895				};
3896
3897				void main()
3898				{
3899					${SETUP}
3900
3901					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
3902					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
3903					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
3904
3905					Test[4] x[5][5] = Test[5][5][4] (	Test[5][4] (Test[4] (c, c, c, c),
3906																	Test[4] (b, b, b, b),
3907																	Test[4] (a, a, a, a),
3908																	Test[4] (c, c, c, c),
3909																	Test[4] (b, b, b, b) ),
3910
3911														Test[5][4] (Test[4] (a, a, a, a),
3912																	Test[4] (b, b, b, b),
3913																	Test[4] (c, c, c, c),
3914																	Test[4] (a, a, a, a),
3915																	Test[4] (b, b, b, b) ),
3916
3917														Test[5][4] (Test[4] (b, b, b, b),
3918																	Test[4] (c, c, c, c),
3919																	Test[4] (a, a, a, a),
3920																	Test[4] (b, b, b, b),
3921																	Test[4] (c, c, c, c) ),
3922
3923														Test[5][4] (Test[4] (c, c, c, c),
3924																	Test[4] (b, b, b, b),
3925																	Test[4] (a, a, a, a),
3926																	Test[4] (c, c, c, c),
3927																	Test[4] (b, b, b, b) ),
3928
3929														Test[5][4] (Test[4] (a, a, a, a),
3930																	Test[4] (b, b, b, b),
3931																	Test[4] (c, c, c, c),
3932																	Test[4] (a, a, a, a),
3933																	Test[4] (b, b, b, b) ) );
3934
3935					Test y[5][5][4] = x;
3936
3937					out0 = vec3(y[0][0][0].v.x, y[1][1][1].v.y, y[4][3][3].v.z);
3938					${OUTPUT}
3939				}
3940			""
3941		end
3942
3943		case vec3_1x3
3944			version 320 es
3945			desc "Testing assignment of arrays of arrays with explicit size"
3946			values
3947			{
3948				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
3949				output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(-0.5, 1.0, 11.2) ];
3950			}
3951
3952			both ""
3953				#version 320 es
3954				precision mediump float;
3955				${DECLARATIONS}
3956
3957				void main()
3958				{
3959					${SETUP}
3960					vec3 x[1][3] = vec3[1][3] (	vec3[3] (vec3(in0.x, in0.y, -in0.z),
3961														vec3(in0.y, -in0.z, in0.x),
3962														vec3(-in0.z, in0.x, in0.y)) );
3963
3964					vec3 y[1][3] = x;
3965
3966					out0 = vec3(y[0][0].x, y[0][1].y, y[0][2].z);
3967					${OUTPUT}
3968				}
3969			""
3970		end
3971
3972		case ivec3_3x1x3
3973			version 320 es
3974			desc "Testing assignment of arrays of arrays with explicit size"
3975			values
3976			{
3977				input ivec3 in0 =		[ ivec3(0, 1, 2) | ivec3(5, 11, -1) ];
3978				output ivec3 out0 = [ ivec3(0, -2, 1) | ivec3(5, 1, 11) ];
3979			}
3980
3981			both ""
3982				#version 320 es
3983				precision mediump int;
3984				precision mediump float;
3985				${DECLARATIONS}
3986
3987				void main()
3988				{
3989					${SETUP}
3990					ivec3[3][1][3] x = ivec3[3][1][3] (	ivec3[1][3] (ivec3[3] (	ivec3(in0.x, in0.y, -in0.z),
3991																				ivec3(0.0, 0.0, 0.0),
3992																				ivec3(0.0, 0.0, 0.0)) ),
3993
3994														ivec3[1][3] (ivec3[3] (	ivec3(0.0, 0.0, 0.0),
3995																				ivec3(in0.y, -in0.z, in0.x),
3996																				ivec3(0.0, 0.0, 0.0)) ),
3997
3998														ivec3[1][3] (ivec3[3] (	ivec3(0.0, 0.0, 0.0),
3999																				ivec3(0.0, 0.0, 0.0),
4000																				ivec3(-in0.z, in0.x, in0.y)) ) );
4001
4002					ivec3[3] y[3][1] = x;
4003
4004					out0 = ivec3(y[0][0][0].x, y[1][0][1].y, y[2][0][2].z);
4005					${OUTPUT}
4006				}
4007			""
4008		end
4009
4010		case bvec3_3x1
4011			version 320 es
4012			desc "Testing assignment of arrays of arrays with explicit size"
4013			values
4014			{
4015				input bvec3 in0 =		[ bvec3(true, false, true) ];
4016				output bvec3 out0 = [ bvec3(true, true, false) ];
4017			}
4018
4019			both ""
4020				#version 320 es
4021				precision mediump float;
4022				${DECLARATIONS}
4023
4024				void main()
4025				{
4026					${SETUP}
4027					bvec3[3][1] x = bvec3[3][1] (	bvec3[1] ( bvec3(in0.x, in0.y, in0.z)),
4028													bvec3[1] ( bvec3(in0.y, in0.z, in0.x)),
4029													bvec3[1] ( bvec3(in0.z, in0.x, in0.y)) );
4030
4031					bvec3[3][1] y = x;
4032
4033					out0 = bvec3(y[0][0].x, y[1][0].y, y[2][0].z);
4034					${OUTPUT}
4035				}
4036			""
4037		end
4038
4039		case mat3_3x2
4040			version 320 es
4041			desc "Testing assignment of arrays of arrays with explicit size"
4042			values
4043			{
4044				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
4045				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
4046			}
4047
4048			both ""
4049				#version 320 es
4050				precision mediump float;
4051				${DECLARATIONS}
4052
4053				void main()
4054				{
4055					${SETUP}
4056					mat3[3][2] a = mat3[3][2] (	mat3[2] (mat3(	in0.x, in0.y, in0.z,
4057																in0.x, in0.y, in0.z,
4058																in0.x, in0.y, in0.z),
4059														 mat3(	in0.z, in0.x, -in0.y,
4060																in0.z, in0.x, -in0.y,
4061																in0.z, in0.x, -in0.y)),
4062
4063												mat3[2] (mat3(	-in0.z, -in0.z, in0.z,
4064																-in0.y, -in0.y, in0.y,
4065																-in0.x, -in0.x, in0.x),
4066														 mat3(	in0.x, in0.y, in0.z,
4067																in0.x, in0.y, in0.z,
4068																in0.x, in0.y, in0.z)),
4069
4070												mat3[2] (mat3(	in0.z, in0.x, -in0.y,
4071																in0.z, in0.x, -in0.y,
4072																in0.z, in0.x, -in0.y),
4073														 mat3(	-in0.z, -in0.z, in0.z,
4074																-in0.y, -in0.y, in0.y,
4075																-in0.x, -in0.x, in0.x)) );
4076
4077					mat3[2] y[3] = a;
4078
4079					mat3 a0 = y[0][0];
4080					mat3 a1 = y[0][1];
4081					mat3 a2 = y[2][1];
4082
4083					float ret0 = a0[2][0];
4084					float ret1 = a1[0][2];
4085					float ret2 = a2[1][2];
4086
4087					out0 = vec3(ret0, ret1, ret2);
4088					${OUTPUT}
4089				}
4090			""
4091		end
4092
4093		case mat3_3x3x3
4094			version 320 es
4095			desc "Testing assignment of arrays of arrays with explicit size"
4096			values
4097			{
4098				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
4099				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
4100			}
4101
4102			both ""
4103				#version 320 es
4104				precision mediump int;
4105				precision mediump float;
4106				${DECLARATIONS}
4107
4108				void main()
4109				{
4110					${SETUP}
4111
4112					mat3 a = mat3(	in0.x, in0.y, in0.z,
4113									in0.x, in0.y, in0.z,
4114									in0.x, in0.y, in0.z);
4115					mat3 b = mat3(	in0.z, in0.x, -in0.y,
4116									in0.z, in0.x, -in0.y,
4117									in0.z, in0.x, -in0.y);
4118					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
4119									-in0.y, -in0.y, in0.y,
4120									-in0.x, -in0.x, in0.x);
4121
4122					mat3[3][3][3] x = mat3[3][3][3] (mat3[3][3] (mat3[3] (a, a, a),
4123																mat3[3] (b, b, b),
4124																mat3[3] (c, c, c)),
4125
4126													mat3[3][3] (mat3[3] (b, b, b),
4127																mat3[3] (a, a, a),
4128																mat3[3] (c, c, c)),
4129
4130													mat3[3][3] (mat3[3] (c, c, c),
4131																mat3[3] (a, a, a),
4132																mat3[3] (b, b, b)) );
4133
4134					mat3 y[3][3][3] = x;
4135
4136					mat3 x0 = y[0][0][0];
4137					mat3 x1 = y[1][0][0];
4138					mat3 x2 = y[2][0][0];
4139
4140					float ret0 = x0[2][0];
4141					float ret1 = x1[0][2];
4142					float ret2 = x2[1][2];
4143
4144					out0 = ivec3(ret0, ret1, ret2);
4145					${OUTPUT}
4146				}
4147			""
4148		end
4149
4150		case mat3_3x4
4151			version 320 es
4152			desc "Testing assignment of arrays of arrays with explicit size"
4153			values
4154			{
4155				input bvec3 in0 = [ bvec3(true, false, true) ];
4156				output bvec3 out0 = [ bvec3(true, false, false) ];
4157			}
4158
4159			both ""
4160				#version 320 es
4161				precision mediump float;
4162				${DECLARATIONS}
4163
4164				void main()
4165				{
4166					${SETUP}
4167
4168					mat3 a = mat3(	in0.x, in0.y, in0.z,
4169									in0.x, in0.y, in0.z,
4170									in0.x, in0.y, in0.z);
4171
4172					mat3 b = mat3(	in0.z, in0.x, in0.y,
4173									in0.z, in0.x, in0.y,
4174									in0.z, in0.x, in0.y);
4175
4176					mat3 c = mat3(	in0.z, in0.z, in0.z,
4177									in0.y, in0.y, in0.y,
4178									in0.x, in0.x, in0.x);
4179
4180					mat3[4] x[3] = mat3[3][4] (	mat3[4] (a, b, c, a),
4181												mat3[4] (b, c, a, b),
4182												mat3[4] (c, a, b, c) );
4183
4184					mat3 y[3][4] = x;
4185
4186					mat3 x0 = y[0][0];
4187					mat3 x1 = y[1][3];
4188					mat3 x2 = y[2][0];
4189
4190					float ret0 = x0[2][0];
4191					float ret1 = x1[0][2];
4192					float ret2 = x2[1][2];
4193
4194					out0 = bvec3(ret0, ret1, ret2);
4195					${OUTPUT}
4196				}
4197			""
4198		end
4199
4200	end # explicit_to_explicit
4201
4202	group explicit_to_implicit "Declaring an array of arrays with explicit size and assigning it to another array of arrays with implicit size"
4203
4204		case float_3x3
4205			version 320 es
4206			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4207			values
4208			{
4209				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
4210				output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
4211			}
4212
4213			both ""
4214				#version 320 es
4215				precision mediump float;
4216				${DECLARATIONS}
4217
4218				void main()
4219				{
4220					${SETUP}
4221					float x[3][3] = float[3][3] (		float[3] (in0.z, in0.x, in0.y),
4222													float[3] (in0.z, in0.x, in0.y),
4223													float[3] (in0.z, in0.x, in0.y) );
4224
4225					float[] y[] = x;
4226
4227					out0 = vec3(y[0][0], y[1][1], y[2][2]);
4228					${OUTPUT}
4229				}
4230			""
4231		end
4232
4233		case int_2x3
4234			version 320 es
4235			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4236			values
4237			{
4238				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
4239				output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
4240			}
4241
4242			both ""
4243				#version 320 es
4244				precision mediump int;
4245				precision mediump float;
4246				${DECLARATIONS}
4247
4248				void main()
4249				{
4250					${SETUP}
4251					int[2][3] x = int[2][3] (		int[3] (in0.z, in0.x, in0.y),
4252												int[3] (in0.z, in0.x, in0.y) );;
4253					int y[][] = x;
4254
4255					out0 = ivec3(y[0][0], y[1][1], y[0][2]);
4256					${OUTPUT}
4257				}
4258			""
4259		end
4260
4261		case bool_3x3x3
4262			version 320 es
4263			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4264			values
4265			{
4266				input bvec3 in0 = [ bvec3(false, true, true) ];
4267				output bvec3 out0 = [ bvec3(true, false, true) ];
4268			}
4269
4270			both ""
4271				#version 320 es
4272				precision mediump float;
4273				${DECLARATIONS}
4274
4275				void main()
4276				{
4277					${SETUP}
4278					bool[3][3] x[3] = bool[3][3][3] (bool[3][3] (bool[3](in0.z, in0.z, in0.z),
4279																bool[3](in0.z, in0.z, in0.z),
4280																bool[3](in0.z, in0.z, in0.z)),
4281
4282													bool[3][3] (bool[3](in0.x, in0.x, in0.x),
4283																bool[3](in0.x, in0.x, in0.x),
4284																bool[3](in0.x, in0.x, in0.x)),
4285
4286													bool[3][3] (bool[3](in0.y, in0.y, in0.y),
4287																bool[3](in0.y, in0.y, in0.y),
4288																bool[3](in0.y, in0.y, in0.y)) );
4289
4290					bool[] y[][] = x;
4291
4292					out0 = bvec3(y[0][0][0], y[1][1][1], y[2][2][2]);
4293					${OUTPUT}
4294				}
4295			""
4296		end
4297
4298		case struct_5x5x4
4299			version 320 es
4300			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4301			values
4302			{
4303				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
4304				output vec3 out0 = [ vec3(-1.0, -0.5, 2.0) ];
4305			}
4306
4307			both ""
4308				#version 320 es
4309				precision mediump float;
4310				${DECLARATIONS}
4311
4312				struct Test
4313				{
4314					float f;
4315					vec3 v;
4316				};
4317
4318				void main()
4319				{
4320					${SETUP}
4321
4322					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
4323					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
4324					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
4325
4326					Test[4] x[5][5] = Test[5][5][4] (Test[5][4] (Test[4] (c, c, c, c),
4327																Test[4] (b, b, b, b),
4328																Test[4] (a, a, a, a),
4329																Test[4] (c, c, c, c),
4330																Test[4] (b, b, b, b) ),
4331
4332													Test[5][4] (Test[4] (a, a, a, a),
4333																Test[4] (b, b, b, b),
4334																Test[4] (c, c, c, c),
4335																Test[4] (a, a, a, a),
4336																Test[4] (b, b, b, b) ),
4337
4338													Test[5][4] (Test[4] (b, b, b, b),
4339																Test[4] (c, c, c, c),
4340																Test[4] (a, a, a, a),
4341																Test[4] (b, b, b, b),
4342																Test[4] (c, c, c, c) ),
4343
4344													Test[5][4] (Test[4] (c, c, c, c),
4345																Test[4] (b, b, b, b),
4346																Test[4] (a, a, a, a),
4347																Test[4] (c, c, c, c),
4348																Test[4] (b, b, b, b) ),
4349
4350													Test[5][4] (Test[4] (a, a, a, a),
4351																Test[4] (b, b, b, b),
4352																Test[4] (c, c, c, c),
4353																Test[4] (a, a, a, a),
4354																Test[4] (b, b, b, b) ) );
4355
4356					Test y[][][] = x;
4357
4358					out0 = vec3(y[0][0][0].v.x, y[1][1][1].v.y, y[4][3][3].v.z);
4359					${OUTPUT}
4360				}
4361			""
4362		end
4363
4364		case vec3_1x3
4365			version 320 es
4366			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4367			values
4368			{
4369				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
4370				output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(-0.5, 1.0, 11.2) ];
4371			}
4372
4373			both ""
4374				#version 320 es
4375				precision mediump float;
4376				${DECLARATIONS}
4377
4378				void main()
4379				{
4380					${SETUP}
4381					vec3 x[1][3] = vec3[1][3] (	vec3[3] (vec3(in0.x, in0.y, -in0.z),
4382														vec3(in0.y, -in0.z, in0.x),
4383														vec3(-in0.z, in0.x, in0.y)) );
4384
4385					vec3 y[][] = x;
4386
4387					out0 = vec3(y[0][0].x, y[0][1].y, y[0][2].z);
4388					${OUTPUT}
4389				}
4390			""
4391		end
4392
4393		case ivec3_3x1x3
4394			version 320 es
4395			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4396			values
4397			{
4398				input ivec3 in0 =		[ ivec3(0, 1, 2) | ivec3(5, 11, -1) ];
4399				output ivec3 out0 = [ ivec3(0, -2, 1) | ivec3(5, 1, 11) ];
4400			}
4401
4402			both ""
4403				#version 320 es
4404				precision mediump int;
4405				precision mediump float;
4406				${DECLARATIONS}
4407
4408				void main()
4409				{
4410					${SETUP}
4411					ivec3[3][1][3] x = ivec3[3][1][3] (	ivec3[1][3] (ivec3[3] (	ivec3(in0.x, in0.y, -in0.z),
4412																				ivec3(0.0, 0.0, 0.0),
4413																				ivec3(0.0, 0.0, 0.0)) ),
4414
4415														ivec3[1][3] (ivec3[3] (	ivec3(0.0, 0.0, 0.0),
4416																				ivec3(in0.y, -in0.z, in0.x),
4417																				ivec3(0.0, 0.0, 0.0)) ),
4418
4419														ivec3[1][3] (ivec3[3] (	ivec3(0.0, 0.0, 0.0),
4420																				ivec3(0.0, 0.0, 0.0),
4421																				ivec3(-in0.z, in0.x, in0.y)) ) );
4422
4423					ivec3[] y[][] = x;
4424
4425					out0 = ivec3(y[0][0][0].x, y[1][0][1].y, y[2][0][2].z);
4426					${OUTPUT}
4427				}
4428			""
4429		end
4430
4431		case bvec3_3x1
4432			version 320 es
4433			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4434			values
4435			{
4436				input bvec3 in0 =		[ bvec3(true, false, true) ];
4437				output bvec3 out0 = [ bvec3(true, true, false) ];
4438			}
4439
4440			both ""
4441				#version 320 es
4442				precision mediump float;
4443				${DECLARATIONS}
4444
4445				void main()
4446				{
4447					${SETUP}
4448					bvec3[3][1] x = bvec3[3][1] (	bvec3[1] ( bvec3(in0.x, in0.y, in0.z)),
4449													bvec3[1] ( bvec3(in0.y, in0.z, in0.x)),
4450													bvec3[1] ( bvec3(in0.z, in0.x, in0.y)) );
4451
4452					bvec3[][] y = x;
4453
4454					out0 = bvec3(y[0][0].x, y[1][0].y, y[2][0].z);
4455					${OUTPUT}
4456				}
4457			""
4458		end
4459
4460		case mat3_3x2
4461			version 320 es
4462			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4463			values
4464			{
4465				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
4466				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
4467			}
4468
4469			both ""
4470				#version 320 es
4471				precision mediump float;
4472				${DECLARATIONS}
4473
4474				void main()
4475				{
4476					${SETUP}
4477					mat3[3][2] a = mat3[3][2] (	mat3[2] (mat3(	in0.x, in0.y, in0.z,
4478																in0.x, in0.y, in0.z,
4479																in0.x, in0.y, in0.z),
4480														 mat3(	in0.z, in0.x, -in0.y,
4481																in0.z, in0.x, -in0.y,
4482																in0.z, in0.x, -in0.y)),
4483
4484												mat3[2] (mat3(	-in0.z, -in0.z, in0.z,
4485																-in0.y, -in0.y, in0.y,
4486																-in0.x, -in0.x, in0.x),
4487														 mat3(	in0.x, in0.y, in0.z,
4488																in0.x, in0.y, in0.z,
4489																in0.x, in0.y, in0.z)),
4490
4491												mat3[2] (mat3(	in0.z, in0.x, -in0.y,
4492																in0.z, in0.x, -in0.y,
4493																in0.z, in0.x, -in0.y),
4494														 mat3(	-in0.z, -in0.z, in0.z,
4495																-in0.y, -in0.y, in0.y,
4496																-in0.x, -in0.x, in0.x)) );
4497
4498					mat3[] y[] = a;
4499
4500					mat3 a0 = y[0][0];
4501					mat3 a1 = y[0][1];
4502					mat3 a2 = y[2][1];
4503
4504					float ret0 = a0[2][0];
4505					float ret1 = a1[0][2];
4506					float ret2 = a2[1][2];
4507
4508					out0 = vec3(ret0, ret1, ret2);
4509					${OUTPUT}
4510				}
4511			""
4512		end
4513
4514		case mat3_3x3x3
4515			version 320 es
4516			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4517			values
4518			{
4519				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
4520				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
4521			}
4522
4523			both ""
4524				#version 320 es
4525				precision mediump int;
4526				precision mediump float;
4527				${DECLARATIONS}
4528
4529				void main()
4530				{
4531					${SETUP}
4532
4533					mat3 a = mat3(	in0.x, in0.y, in0.z,
4534									in0.x, in0.y, in0.z,
4535									in0.x, in0.y, in0.z);
4536					mat3 b = mat3(	in0.z, in0.x, -in0.y,
4537									in0.z, in0.x, -in0.y,
4538									in0.z, in0.x, -in0.y);
4539					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
4540									-in0.y, -in0.y, in0.y,
4541									-in0.x, -in0.x, in0.x);
4542
4543					mat3[3][3][3] x = mat3[3][3][3] (mat3[3][3] (mat3[3] (a, a, a),
4544																mat3[3] (b, b, b),
4545																mat3[3] (c, c, c)),
4546
4547													mat3[3][3] (mat3[3] (b, b, b),
4548																mat3[3] (a, a, a),
4549																mat3[3] (c, c, c)),
4550
4551													mat3[3][3] (mat3[3] (c, c, c),
4552																mat3[3] (a, a, a),
4553																mat3[3] (b, b, b)) );
4554
4555					mat3 y[][][] = x;
4556
4557					mat3 x0 = y[0][0][0];
4558					mat3 x1 = y[1][0][0];
4559					mat3 x2 = y[2][0][0];
4560
4561					float ret0 = x0[2][0];
4562					float ret1 = x1[0][2];
4563					float ret2 = x2[1][2];
4564
4565					out0 = ivec3(ret0, ret1, ret2);
4566					${OUTPUT}
4567				}
4568			""
4569		end
4570
4571		case mat3_3x4
4572			version 320 es
4573			desc "Testing assignment of arrays of arrays from explicitly sized to implicitly sized"
4574			values
4575			{
4576				input bvec3 in0 = [ bvec3(true, false, true) ];
4577				output bvec3 out0 = [ bvec3(true, false, false) ];
4578			}
4579
4580			both ""
4581				#version 320 es
4582				precision mediump float;
4583				${DECLARATIONS}
4584
4585				void main()
4586				{
4587					${SETUP}
4588
4589					mat3 a = mat3(	in0.x, in0.y, in0.z,
4590									in0.x, in0.y, in0.z,
4591									in0.x, in0.y, in0.z);
4592
4593					mat3 b = mat3(	in0.z, in0.x, in0.y,
4594									in0.z, in0.x, in0.y,
4595									in0.z, in0.x, in0.y);
4596
4597					mat3 c = mat3(	in0.z, in0.z, in0.z,
4598									in0.y, in0.y, in0.y,
4599									in0.x, in0.x, in0.x);
4600
4601					mat3[4] x[3] = mat3[3][4] (	mat3[4] (a, b, c, a),
4602												mat3[4] (b, c, a, b),
4603												mat3[4] (c, a, b, c) );
4604
4605					mat3 y[][] = x;
4606
4607					mat3 x0 = y[0][0];
4608					mat3 x1 = y[1][3];
4609					mat3 x2 = y[2][0];
4610
4611					float ret0 = x0[2][0];
4612					float ret1 = x1[0][2];
4613					float ret2 = x2[1][2];
4614
4615					out0 = bvec3(ret0, ret1, ret2);
4616					${OUTPUT}
4617				}
4618			""
4619		end
4620
4621	end # explicit_to_implicit
4622
4623	group implicit_to_explicit "Declaring an array of arrays with implicit size and assigning it to another array of arrays with explicit size"
4624
4625		case float_3x3
4626			version 320 es
4627			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4628			values
4629			{
4630				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
4631				output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
4632			}
4633
4634			both ""
4635				#version 320 es
4636				precision mediump float;
4637				${DECLARATIONS}
4638
4639				void main()
4640				{
4641					${SETUP}
4642					float x[][] = float[][] (		float[] (in0.z, in0.x, in0.y),
4643												float[] (in0.z, in0.x, in0.y),
4644												float[] (in0.z, in0.x, in0.y) );
4645
4646					float[3] y[3] = x;
4647
4648					out0 = vec3(y[0][0], y[1][1], y[2][2]);
4649					${OUTPUT}
4650				}
4651			""
4652		end
4653
4654		case int_2x3
4655			version 320 es
4656			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4657			values
4658			{
4659				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
4660				output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
4661			}
4662
4663			both ""
4664				#version 320 es
4665				precision mediump int;
4666				precision mediump float;
4667				${DECLARATIONS}
4668
4669				void main()
4670				{
4671					${SETUP}
4672					int[][] x = int[][] (		int[] (in0.z, in0.x, in0.y),
4673											int[] (in0.z, in0.x, in0.y) );;
4674					int y[2][3] = x;
4675
4676					out0 = ivec3(y[0][0], y[1][1], y[0][2]);
4677					${OUTPUT}
4678				}
4679			""
4680		end
4681
4682		case bool_3x3x3
4683			version 320 es
4684			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4685			values
4686			{
4687				input bvec3 in0 = [ bvec3(false, true, true) ];
4688				output bvec3 out0 = [ bvec3(true, false, true) ];
4689			}
4690
4691			both ""
4692				#version 320 es
4693				precision mediump float;
4694				${DECLARATIONS}
4695
4696				void main()
4697				{
4698					${SETUP}
4699					bool[][] x[] = bool[][][] ( bool[][] (	bool[](in0.z, in0.z, in0.z),
4700															bool[](in0.z, in0.z, in0.z),
4701															bool[](in0.z, in0.z, in0.z)),
4702
4703												bool[][] (	bool[](in0.x, in0.x, in0.x),
4704															bool[](in0.x, in0.x, in0.x),
4705															bool[](in0.x, in0.x, in0.x)),
4706
4707												bool[][] (	bool[](in0.y, in0.y, in0.y),
4708															bool[](in0.y, in0.y, in0.y),
4709															bool[](in0.y, in0.y, in0.y)) );
4710
4711					bool[3] y[3][3] = x;
4712
4713					out0 = bvec3(y[0][0][0], y[1][1][1], y[2][2][2]);
4714					${OUTPUT}
4715				}
4716			""
4717		end
4718
4719		case struct_5x5x4
4720			version 320 es
4721			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4722			values
4723			{
4724				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
4725				output vec3 out0 = [ vec3(-1.0, -0.5, 2.0) ];
4726			}
4727
4728			both ""
4729				#version 320 es
4730				precision mediump float;
4731				${DECLARATIONS}
4732
4733				struct Test
4734				{
4735					float f;
4736					vec3 v;
4737				};
4738
4739				void main()
4740				{
4741					${SETUP}
4742
4743					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
4744					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
4745					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
4746
4747					Test[] x[][] = Test[][][] (	Test[][] (	Test[] (c, c, c, c),
4748															Test[] (b, b, b, b),
4749															Test[] (a, a, a, a),
4750															Test[] (c, c, c, c),
4751															Test[] (b, b, b, b) ),
4752
4753												Test[][] (	Test[] (a, a, a, a),
4754															Test[] (b, b, b, b),
4755															Test[] (c, c, c, c),
4756															Test[] (a, a, a, a),
4757															Test[] (b, b, b, b) ),
4758
4759												Test[][] (	Test[] (b, b, b, b),
4760															Test[] (c, c, c, c),
4761															Test[] (a, a, a, a),
4762															Test[] (b, b, b, b),
4763															Test[] (c, c, c, c) ),
4764
4765												Test[][] (	Test[] (c, c, c, c),
4766															Test[] (b, b, b, b),
4767															Test[] (a, a, a, a),
4768															Test[] (c, c, c, c),
4769															Test[] (b, b, b, b) ),
4770
4771												Test[][] (	Test[] (a, a, a, a),
4772															Test[] (b, b, b, b),
4773															Test[] (c, c, c, c),
4774															Test[] (a, a, a, a),
4775															Test[] (b, b, b, b) ) );
4776
4777					Test y[5][5][4] = x;
4778
4779					out0 = vec3(y[0][0][0].v.x, y[1][1][1].v.y, y[4][3][3].v.z);
4780					${OUTPUT}
4781				}
4782			""
4783		end
4784
4785		case vec3_1x3
4786			version 320 es
4787			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4788			values
4789			{
4790				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
4791				output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(-0.5, 1.0, 11.2) ];
4792			}
4793
4794			both ""
4795				#version 320 es
4796				precision mediump float;
4797				${DECLARATIONS}
4798
4799				void main()
4800				{
4801					${SETUP}
4802					vec3 x[][] = vec3[][] (	vec3[] (vec3(in0.x, in0.y, -in0.z),
4803													vec3(in0.y, -in0.z, in0.x),
4804													vec3(-in0.z, in0.x, in0.y)) );
4805
4806					vec3 y[1][3] = x;
4807
4808					out0 = vec3(y[0][0].x, y[0][1].y, y[0][2].z);
4809					${OUTPUT}
4810				}
4811			""
4812		end
4813
4814		case ivec3_3x1x3
4815			version 320 es
4816			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4817			values
4818			{
4819				input ivec3 in0 =		[ ivec3(0, 1, 2) | ivec3(5, 11, -1) ];
4820				output ivec3 out0 = [ ivec3(0, -2, 1) | ivec3(5, 1, 11) ];
4821			}
4822
4823			both ""
4824				#version 320 es
4825				precision mediump int;
4826				precision mediump float;
4827				${DECLARATIONS}
4828
4829				void main()
4830				{
4831					${SETUP}
4832					ivec3[][][] x = ivec3[][][] (	ivec3[][] (	ivec3[] (	ivec3(in0.x, in0.y, -in0.z),
4833																				ivec3(0.0, 0.0, 0.0),
4834																				ivec3(0.0, 0.0, 0.0)) ),
4835
4836														ivec3[][] ( ivec3[] (	ivec3(0.0, 0.0, 0.0),
4837																				ivec3(in0.y, -in0.z, in0.x),
4838																				ivec3(0.0, 0.0, 0.0)) ),
4839
4840														ivec3[][] (	ivec3[] (	ivec3(0.0, 0.0, 0.0),
4841																				ivec3(0.0, 0.0, 0.0),
4842																				ivec3(-in0.z, in0.x, in0.y)) ) );
4843
4844					ivec3[3] y[3][1] = x;
4845
4846					out0 = ivec3(y[0][0][0].x, y[1][0][1].y, y[2][0][2].z);
4847					${OUTPUT}
4848				}
4849			""
4850		end
4851
4852		case bvec3_3x1
4853			version 320 es
4854			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4855			values
4856			{
4857				input bvec3 in0 =		[ bvec3(true, false, true) ];
4858				output bvec3 out0 = [ bvec3(true, true, false) ];
4859			}
4860
4861			both ""
4862				#version 320 es
4863				precision mediump float;
4864				${DECLARATIONS}
4865
4866				void main()
4867				{
4868					${SETUP}
4869					bvec3[][] x = bvec3[][] (	bvec3[] ( bvec3(in0.x, in0.y, in0.z)),
4870												bvec3[] ( bvec3(in0.y, in0.z, in0.x)),
4871												bvec3[] ( bvec3(in0.z, in0.x, in0.y)) );
4872
4873					bvec3[3][1] y = x;
4874
4875					out0 = bvec3(y[0][0].x, y[1][0].y, y[2][0].z);
4876					${OUTPUT}
4877				}
4878			""
4879		end
4880
4881		case mat3_3x2
4882			version 320 es
4883			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4884			values
4885			{
4886				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
4887				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
4888			}
4889
4890			both ""
4891				#version 320 es
4892				precision mediump float;
4893				${DECLARATIONS}
4894
4895				void main()
4896				{
4897					${SETUP}
4898					mat3[][] a = mat3[][] (	mat3[] ( mat3(	in0.x, in0.y, in0.z,
4899															in0.x, in0.y, in0.z,
4900															in0.x, in0.y, in0.z),
4901													 mat3(	in0.z, in0.x, -in0.y,
4902															in0.z, in0.x, -in0.y,
4903															in0.z, in0.x, -in0.y)),
4904
4905											mat3[] ( mat3(	-in0.z, -in0.z, in0.z,
4906															-in0.y, -in0.y, in0.y,
4907															-in0.x, -in0.x, in0.x),
4908													 mat3(	in0.x, in0.y, in0.z,
4909															in0.x, in0.y, in0.z,
4910															in0.x, in0.y, in0.z)),
4911
4912											mat3[] ( mat3(	in0.z, in0.x, -in0.y,
4913															in0.z, in0.x, -in0.y,
4914															in0.z, in0.x, -in0.y),
4915													 mat3(	-in0.z, -in0.z, in0.z,
4916															-in0.y, -in0.y, in0.y,
4917															-in0.x, -in0.x, in0.x)) );
4918
4919					mat3[2] y[3] = a;
4920
4921					mat3 a0 = y[0][0];
4922					mat3 a1 = y[0][1];
4923					mat3 a2 = y[2][1];
4924
4925					float ret0 = a0[2][0];
4926					float ret1 = a1[0][2];
4927					float ret2 = a2[1][2];
4928
4929					out0 = vec3(ret0, ret1, ret2);
4930					${OUTPUT}
4931				}
4932			""
4933		end
4934
4935		case mat3_3x3x3
4936			version 320 es
4937			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4938			values
4939			{
4940				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
4941				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
4942			}
4943
4944			both ""
4945				#version 320 es
4946				precision mediump int;
4947				precision mediump float;
4948				${DECLARATIONS}
4949
4950				void main()
4951				{
4952					${SETUP}
4953
4954					mat3 a = mat3(	in0.x, in0.y, in0.z,
4955									in0.x, in0.y, in0.z,
4956									in0.x, in0.y, in0.z);
4957					mat3 b = mat3(	in0.z, in0.x, -in0.y,
4958									in0.z, in0.x, -in0.y,
4959									in0.z, in0.x, -in0.y);
4960					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
4961									-in0.y, -in0.y, in0.y,
4962									-in0.x, -in0.x, in0.x);
4963
4964					mat3[][][] x = mat3[][][] (	mat3[][] (		mat3[] (a, a, a),
4965															mat3[] (b, b, b),
4966															mat3[] (c, c, c)),
4967
4968												mat3[][] (		mat3[] (b, b, b),
4969															mat3[] (a, a, a),
4970															mat3[] (c, c, c)),
4971
4972												mat3[][] (		mat3[] (c, c, c),
4973															mat3[] (a, a, a),
4974															mat3[] (b, b, b)) );
4975
4976					mat3 y[3][3][3] = x;
4977
4978					mat3 x0 = y[0][0][0];
4979					mat3 x1 = y[1][0][0];
4980					mat3 x2 = y[2][0][0];
4981
4982					float ret0 = x0[2][0];
4983					float ret1 = x1[0][2];
4984					float ret2 = x2[1][2];
4985
4986					out0 = ivec3(ret0, ret1, ret2);
4987					${OUTPUT}
4988				}
4989			""
4990		end
4991
4992		case mat3_3x4
4993			version 320 es
4994			desc "Testing assignment of arrays of arrays from implicitly sized to explicitly sized"
4995			values
4996			{
4997				input bvec3 in0 = [ bvec3(true, false, true) ];
4998				output bvec3 out0 = [ bvec3(true, false, false) ];
4999			}
5000
5001			both ""
5002				#version 320 es
5003				precision mediump float;
5004				${DECLARATIONS}
5005
5006				void main()
5007				{
5008					${SETUP}
5009
5010					mat3 a = mat3(	in0.x, in0.y, in0.z,
5011									in0.x, in0.y, in0.z,
5012									in0.x, in0.y, in0.z);
5013
5014					mat3 b = mat3(	in0.z, in0.x, in0.y,
5015									in0.z, in0.x, in0.y,
5016									in0.z, in0.x, in0.y);
5017
5018					mat3 c = mat3(	in0.z, in0.z, in0.z,
5019									in0.y, in0.y, in0.y,
5020									in0.x, in0.x, in0.x);
5021
5022					mat3[] x[] = mat3[][] (	mat3[] (a, b, c, a),
5023											mat3[] (b, c, a, b),
5024											mat3[] (c, a, b, c) );
5025
5026					mat3 y[3][4] = x;
5027
5028					mat3 x0 = y[0][0];
5029					mat3 x1 = y[1][3];
5030					mat3 x2 = y[2][0];
5031
5032					float ret0 = x0[2][0];
5033					float ret1 = x1[0][2];
5034					float ret2 = x2[1][2];
5035
5036					out0 = bvec3(ret0, ret1, ret2);
5037					${OUTPUT}
5038				}
5039			""
5040		end
5041
5042	end # implicit_to_explicit
5043
5044	group implicit_to_implicit "Declaring an array of arrays with implicit size and assigning it to another array of arrays with implicit size"
5045
5046		case float_3x3
5047			version 320 es
5048			desc "Testing assignment of arrays of arrays with implicit sizes"
5049			values
5050			{
5051				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
5052				output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
5053			}
5054
5055			both ""
5056				#version 320 es
5057				precision mediump float;
5058				${DECLARATIONS}
5059
5060				void main()
5061				{
5062					${SETUP}
5063					float x[][] = float[][] (		float[] (in0.z, in0.x, in0.y),
5064												float[] (in0.z, in0.x, in0.y),
5065												float[] (in0.z, in0.x, in0.y) );
5066
5067					float[] y[] = x;
5068
5069					out0 = vec3(y[0][0], y[1][1], y[2][2]);
5070					${OUTPUT}
5071				}
5072			""
5073		end
5074
5075		case int_2x3
5076			version 320 es
5077			desc "Testing assignment of arrays of arrays with implicit sizes"
5078			values
5079			{
5080				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
5081				output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
5082			}
5083
5084			both ""
5085				#version 320 es
5086				precision mediump int;
5087				precision mediump float;
5088				${DECLARATIONS}
5089
5090				void main()
5091				{
5092					${SETUP}
5093					int[][] x = int[][] (		int[] (in0.z, in0.x, in0.y),
5094											int[] (in0.z, in0.x, in0.y) );;
5095					int y[][] = x;
5096
5097					out0 = ivec3(y[0][0], y[1][1], y[0][2]);
5098					${OUTPUT}
5099				}
5100			""
5101		end
5102
5103		case bool_3x3x3
5104			version 320 es
5105			desc "Testing assignment of arrays of arrays with implicit sizes"
5106			values
5107			{
5108				input bvec3 in0 = [ bvec3(false, true, true) ];
5109				output bvec3 out0 = [ bvec3(true, false, true) ];
5110			}
5111
5112			both ""
5113				#version 320 es
5114				precision mediump float;
5115				${DECLARATIONS}
5116
5117				void main()
5118				{
5119					${SETUP}
5120					bool[][] x[] = bool[][][] ( bool[][] (	bool[](in0.z, in0.z, in0.z),
5121															bool[](in0.z, in0.z, in0.z),
5122															bool[](in0.z, in0.z, in0.z)),
5123
5124												bool[][] (	bool[](in0.x, in0.x, in0.x),
5125															bool[](in0.x, in0.x, in0.x),
5126															bool[](in0.x, in0.x, in0.x)),
5127
5128												bool[][] (	bool[](in0.y, in0.y, in0.y),
5129															bool[](in0.y, in0.y, in0.y),
5130															bool[](in0.y, in0.y, in0.y)) );
5131
5132					bool[] y[][] = x;
5133
5134					out0 = bvec3(y[0][0][0], y[1][1][1], y[2][2][2]);
5135					${OUTPUT}
5136				}
5137			""
5138		end
5139
5140		case struct_5x5x4
5141			version 320 es
5142			desc "Testing assignment of arrays of arrays with implicit sizes"
5143			values
5144			{
5145				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
5146				output vec3 out0 = [ vec3(-1.0, -0.5, 2.0) ];
5147			}
5148
5149			both ""
5150				#version 320 es
5151				precision mediump float;
5152				${DECLARATIONS}
5153
5154				struct Test
5155				{
5156					float f;
5157					vec3 v;
5158				};
5159
5160				void main()
5161				{
5162					${SETUP}
5163
5164					Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
5165					Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
5166					Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
5167
5168					Test[] x[][] = Test[][][] (	Test[][] (	Test[] (c, c, c, c),
5169															Test[] (b, b, b, b),
5170															Test[] (a, a, a, a),
5171															Test[] (c, c, c, c),
5172															Test[] (b, b, b, b) ),
5173
5174												Test[][] (	Test[] (a, a, a, a),
5175															Test[] (b, b, b, b),
5176															Test[] (c, c, c, c),
5177															Test[] (a, a, a, a),
5178															Test[] (b, b, b, b) ),
5179
5180												Test[][] (	Test[] (b, b, b, b),
5181															Test[] (c, c, c, c),
5182															Test[] (a, a, a, a),
5183															Test[] (b, b, b, b),
5184															Test[] (c, c, c, c) ),
5185
5186												Test[][] (	Test[] (c, c, c, c),
5187															Test[] (b, b, b, b),
5188															Test[] (a, a, a, a),
5189															Test[] (c, c, c, c),
5190															Test[] (b, b, b, b) ),
5191
5192												Test[][] (	Test[] (a, a, a, a),
5193															Test[] (b, b, b, b),
5194															Test[] (c, c, c, c),
5195															Test[] (a, a, a, a),
5196															Test[] (b, b, b, b) ) );
5197
5198					Test y[][][] = x;
5199
5200					out0 = vec3(y[0][0][0].v.x, y[1][1][1].v.y, y[4][3][3].v.z);
5201					${OUTPUT}
5202				}
5203			""
5204		end
5205
5206		case vec3_1x3
5207			version 320 es
5208			desc "Testing assignment of arrays of arrays with implicit sizes"
5209			values
5210			{
5211				input vec3 in0 =		[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
5212				output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(-0.5, 1.0, 11.2) ];
5213			}
5214
5215			both ""
5216				#version 320 es
5217				precision mediump float;
5218				${DECLARATIONS}
5219
5220				void main()
5221				{
5222					${SETUP}
5223					vec3 x[][] = vec3[][] (	vec3[] (vec3(in0.x, in0.y, -in0.z)	,
5224													vec3(in0.y, -in0.z, in0.x)	,
5225													vec3(-in0.z, in0.x, in0.y)) );
5226
5227					vec3 y[][] = x;
5228
5229					out0 = vec3(y[0][0].x, y[0][1].y, y[0][2].z);
5230					${OUTPUT}
5231				}
5232			""
5233		end
5234
5235		case ivec3_3x1x3
5236			version 320 es
5237			desc "Testing assignment of arrays of arrays with implicit sizes"
5238			values
5239			{
5240				input ivec3 in0 =		[ ivec3(0, 1, 2) | ivec3(5, 11, -1) ];
5241				output ivec3 out0 = [ ivec3(0, -2, 1) | ivec3(5, 1, 11) ];
5242			}
5243
5244			both ""
5245				#version 320 es
5246				precision mediump int;
5247				precision mediump float;
5248				${DECLARATIONS}
5249
5250				void main()
5251				{
5252					${SETUP}
5253					ivec3[][][] x = ivec3[][][] (	ivec3[][] (	ivec3[] (	ivec3(in0.x, in0.y, -in0.z),
5254																			ivec3(0.0, 0.0, 0.0),
5255																			ivec3(0.0, 0.0, 0.0)) ),
5256
5257													ivec3[][] ( ivec3[] (	ivec3(0.0, 0.0, 0.0),
5258																			ivec3(in0.y, -in0.z, in0.x),
5259																			ivec3(0.0, 0.0, 0.0)) ),
5260
5261													ivec3[][] (	ivec3[] (	ivec3(0.0, 0.0, 0.0),
5262																			ivec3(0.0, 0.0, 0.0),
5263																			ivec3(-in0.z, in0.x, in0.y)) ) );
5264
5265					ivec3[] y[][] = x;
5266
5267					out0 = ivec3(y[0][0][0].x, y[1][0][1].y, y[2][0][2].z);
5268					${OUTPUT}
5269				}
5270			""
5271		end
5272
5273		case bvec3_3x1
5274			version 320 es
5275			desc "Testing assignment of arrays of arrays with implicit sizes"
5276			values
5277			{
5278				input bvec3 in0 =		[ bvec3(true, false, true) ];
5279				output bvec3 out0 = [ bvec3(true, true, false) ];
5280			}
5281
5282			both ""
5283				#version 320 es
5284				precision mediump float;
5285				${DECLARATIONS}
5286
5287				void main()
5288				{
5289					${SETUP}
5290					bvec3[][] x = bvec3[][] (	bvec3[] ( bvec3(in0.x, in0.y, in0.z)),
5291												bvec3[] ( bvec3(in0.y, in0.z, in0.x)),
5292												bvec3[] ( bvec3(in0.z, in0.x, in0.y)) );
5293
5294					bvec3[][] y = x;
5295
5296					out0 = bvec3(y[0][0].x, y[1][0].y, y[2][0].z);
5297					${OUTPUT}
5298				}
5299			""
5300		end
5301
5302		case mat3_3x2
5303			version 320 es
5304			desc "Testing assignment of arrays of arrays with implicit sizes"
5305			values
5306			{
5307				input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
5308				output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
5309			}
5310
5311			both ""
5312				#version 320 es
5313				precision mediump float;
5314				${DECLARATIONS}
5315
5316				void main()
5317				{
5318					${SETUP}
5319					mat3[][] a = mat3[][] (	mat3[] ( mat3(	in0.x, in0.y, in0.z,
5320															in0.x, in0.y, in0.z,
5321															in0.x, in0.y, in0.z),
5322													 mat3(	in0.z, in0.x, -in0.y,
5323															in0.z, in0.x, -in0.y,
5324															in0.z, in0.x, -in0.y)),
5325
5326											mat3[] ( mat3(	-in0.z, -in0.z, in0.z,
5327															-in0.y, -in0.y, in0.y,
5328															-in0.x, -in0.x, in0.x),
5329													 mat3(	in0.x, in0.y, in0.z,
5330															in0.x, in0.y, in0.z,
5331															in0.x, in0.y, in0.z)),
5332
5333											mat3[] ( mat3(	in0.z, in0.x, -in0.y,
5334															in0.z, in0.x, -in0.y,
5335															in0.z, in0.x, -in0.y),
5336													 mat3(	-in0.z, -in0.z, in0.z,
5337															-in0.y, -in0.y, in0.y,
5338															-in0.x, -in0.x, in0.x)) );
5339
5340					mat3[] y[] = a;
5341
5342					mat3 a0 = y[0][0];
5343					mat3 a1 = y[0][1];
5344					mat3 a2 = y[2][1];
5345
5346					float ret0 = a0[2][0];
5347					float ret1 = a1[0][2];
5348					float ret2 = a2[1][2];
5349
5350					out0 = vec3(ret0, ret1, ret2);
5351					${OUTPUT}
5352				}
5353			""
5354		end
5355
5356		case mat3_3x3x3
5357			version 320 es
5358			desc "Testing assignment of arrays of arrays with implicit sizes"
5359			values
5360			{
5361				input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
5362				output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
5363			}
5364
5365			both ""
5366				#version 320 es
5367				precision mediump int;
5368				precision mediump float;
5369				${DECLARATIONS}
5370
5371				void main()
5372				{
5373					${SETUP}
5374
5375					mat3 a = mat3(	in0.x, in0.y, in0.z,
5376									in0.x, in0.y, in0.z,
5377									in0.x, in0.y, in0.z);
5378					mat3 b = mat3(	in0.z, in0.x, -in0.y,
5379									in0.z, in0.x, -in0.y,
5380									in0.z, in0.x, -in0.y);
5381					mat3 c = mat3(	-in0.z, -in0.z, in0.z,
5382									-in0.y, -in0.y, in0.y,
5383									-in0.x, -in0.x, in0.x);
5384
5385					mat3[][][] x = mat3[][][] (	mat3[][] (		mat3[] (a, a, a),
5386															mat3[] (b, b, b),
5387															mat3[] (c, c, c)),
5388
5389												mat3[][] (		mat3[] (b, b, b),
5390															mat3[] (a, a, a),
5391															mat3[] (c, c, c)),
5392
5393												mat3[][] (		mat3[] (c, c, c),
5394															mat3[] (a, a, a),
5395															mat3[] (b, b, b)) );
5396
5397					mat3 y[][][] = x;
5398
5399					mat3 x0 = y[0][0][0];
5400					mat3 x1 = y[1][0][0];
5401					mat3 x2 = y[2][0][0];
5402
5403					float ret0 = x0[2][0];
5404					float ret1 = x1[0][2];
5405					float ret2 = x2[1][2];
5406
5407					out0 = ivec3(ret0, ret1, ret2);
5408					${OUTPUT}
5409				}
5410			""
5411		end
5412
5413		case mat3_3x4
5414			version 320 es
5415			desc "Testing assignment of arrays of arrays with implicit sizes"
5416			values
5417			{
5418				input bvec3 in0 = [ bvec3(true, false, true) ];
5419				output bvec3 out0 = [ bvec3(true, false, false) ];
5420			}
5421
5422			both ""
5423				#version 320 es
5424				precision mediump float;
5425				${DECLARATIONS}
5426
5427				void main()
5428				{
5429					${SETUP}
5430
5431					mat3 a = mat3(	in0.x, in0.y, in0.z,
5432									in0.x, in0.y, in0.z,
5433									in0.x, in0.y, in0.z);
5434
5435					mat3 b = mat3(	in0.z, in0.x, in0.y,
5436									in0.z, in0.x, in0.y,
5437									in0.z, in0.x, in0.y);
5438
5439					mat3 c = mat3(	in0.z, in0.z, in0.z,
5440									in0.y, in0.y, in0.y,
5441									in0.x, in0.x, in0.x);
5442
5443					mat3[] x[] = mat3[][] (	mat3[] (a, b, c, a),
5444											mat3[] (b, c, a, b),
5445											mat3[] (c, a, b, c) );
5446
5447					mat3 y[][] = x;
5448
5449					mat3 x0 = y[0][0];
5450					mat3 x1 = y[1][3];
5451					mat3 x2 = y[2][0];
5452
5453					float ret0 = x0[2][0];
5454					float ret1 = x1[0][2];
5455					float ret2 = x2[1][2];
5456
5457					out0 = bvec3(ret0, ret1, ret2);
5458					${OUTPUT}
5459				}
5460			""
5461		end
5462
5463	end # implicit_to_implicit
5464
5465end # assignment
5466
5467group length "Testing the array length property with arrays of arrays"
5468
5469	case float
5470		version 320 es
5471		desc "Testing the array length property with arrays of arrays"
5472		values
5473		{
5474			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
5475			output ivec2 out0 = [ ivec2(3, 5) ];
5476			output ivec3 out1 = [ ivec3(3, 4, 5) ];
5477			output ivec3 out2 = [ ivec3(1, 2, 13) ];
5478		}
5479
5480		both ""
5481			#version 320 es
5482			precision mediump float;
5483			${DECLARATIONS}
5484
5485			void main()
5486			{
5487				${SETUP}
5488				float[][] x = float[3][5] (	float[5] (in0.z, in0.x, in0.y, in0.x, in0.y),
5489											float[5] (in0.z, in0.x, in0.y, in0.x, in0.y),
5490											float[5] (in0.z, in0.x, in0.y, in0.x, in0.y) );
5491
5492				float[][] y[] = float[][][] (	float[][] ( float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5493															float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5494															float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5495															float[] (in0.z, in0.x, in0.y, in0.x, in0.y) ),
5496
5497												float[][] ( float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5498															float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5499															float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5500															float[] (in0.z, in0.x, in0.y, in0.x, in0.y) ),
5501
5502												float[][] ( float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5503															float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5504															float[] (in0.z, in0.x, in0.y, in0.x, in0.y),
5505															float[] (in0.z, in0.x, in0.y, in0.x, in0.y) ) );
5506
5507				float[1][2][13] z;
5508
5509				out0 = ivec2(x.length(), x[0].length());
5510				out1 = ivec3(y.length(), y[0].length(), y[0][0].length());
5511				out2 = ivec3(z.length(), z[0].length(), z[0][0].length());
5512				${OUTPUT}
5513			}
5514		""
5515	end
5516
5517	case int
5518		version 320 es
5519		desc "Testing the array length property with arrays of arrays"
5520		values
5521		{
5522			input ivec3 in0 = [ ivec3(0, 1, 2) ];
5523			output ivec2 out0 = [ ivec2(2, 7) ];
5524			output ivec3 out1 = [ ivec3(1, 2, 3) ];
5525			output ivec3 out2 = [ ivec3(13, 7, 1) ];
5526		}
5527
5528		both ""
5529			#version 320 es
5530			precision mediump int;
5531			precision mediump float;
5532			${DECLARATIONS}
5533
5534			void main()
5535			{
5536				${SETUP}
5537
5538				int[] x[] = int[][] (	int[] (in0.z, in0.x, in0.y, in0.x, in0.y, in0.z, in0.x),
5539										int[] (in0.z, in0.x, in0.y, in0.x, in0.y, in0.z, in0.x) );
5540
5541				int[] y[][] = int[1][2][3] ( int[2][3] (		int[3] (in0.z, in0.x, in0.y),
5542															int[3] (in0.z, in0.x, in0.y) ));
5543
5544				int z[13][7][1];
5545
5546				out0 = ivec2(x.length(), x[0].length());
5547				out1 = ivec3(y.length(), y[0].length(), y[0][0].length());
5548				out2 = ivec3(z.length(), z[0].length(), z[0][0].length());
5549				${OUTPUT}
5550			}
5551		""
5552	end
5553
5554	case bool
5555		version 320 es
5556		desc "Testing the array length property with arrays of arrays"
5557		values
5558		{
5559			input bvec3 in0 = [ bvec3(true, false, true) ];
5560			output ivec2 out0 = [ ivec2(4, 3) ];
5561			output ivec3 out1 = [ ivec3(2, 1, 3) ];
5562			output ivec3 out2 = [ ivec3(7, 8, 9) ];
5563		}
5564
5565		both ""
5566			#version 320 es
5567			precision mediump float;
5568			${DECLARATIONS}
5569
5570			void main()
5571			{
5572				${SETUP}
5573				bool x[4][3] = bool[][] (	bool[] (in0.z, in0.x, in0.y),
5574											bool[] (in0.z, in0.x, in0.y),
5575											bool[] (in0.z, in0.x, in0.y),
5576											bool[] (in0.z, in0.x, in0.y) );
5577
5578				bool y[2][1][3] = bool[][][] (		bool[][] (	bool[] (in0.z, in0.x, in0.y) ),
5579												bool[][] (	bool[] (in0.z, in0.x, in0.y) ) );
5580
5581				int z[7][8][9];
5582
5583				out0 = ivec2(x.length(), x[0].length());
5584				out1 = ivec3(y.length(), y[0].length(), y[0][0].length());
5585				out2 = ivec3(z.length(), z[0].length(), z[0][0].length());
5586				${OUTPUT}
5587			}
5588		""
5589	end
5590
5591	case struct
5592		version 320 es
5593		desc "Testing the array length property with arrays of arrays"
5594		values
5595		{
5596			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
5597			output ivec2 out0 = [ ivec2(5, 1) ];
5598			output ivec3 out1 = [ ivec3(5, 4, 2) ];
5599			output ivec3 out2 = [ ivec3(100, 101, 102) ];
5600		}
5601
5602		both ""
5603			#version 320 es
5604			precision mediump float;
5605			${DECLARATIONS}
5606
5607			struct Test
5608			{
5609				float f;
5610				vec3 v;
5611			};
5612
5613			void main()
5614			{
5615				${SETUP}
5616
5617				Test a = Test(in0.z, vec3(in0.x, in0.y, in0.z));
5618				Test b = Test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
5619				Test c = Test(in0.x, vec3(-in0.y, in0.z, -in0.x));
5620
5621				Test x[5][1] = Test[5][1] (	Test[1] (a),
5622											Test[1] (b),
5623											Test[1] (c),
5624											Test[1] (a),
5625											Test[1] (b) );
5626
5627				Test y[][][] = Test[][][] ( Test[][] (	Test[] (a, b),
5628														Test[] (a, b),
5629														Test[] (a, b),
5630														Test[] (a, b) ),
5631											Test[][] (	Test[] (a, b),
5632														Test[] (a, b),
5633														Test[] (a, b),
5634														Test[] (a, b) ),
5635											Test[][] (	Test[] (a, b),
5636														Test[] (a, b),
5637														Test[] (a, b),
5638														Test[] (a, b) ),
5639											Test[][] (	Test[] (a, b),
5640														Test[] (a, b),
5641														Test[] (a, b),
5642														Test[] (a, b) ),
5643											Test[][] (	Test[] (a, b),
5644														Test[] (a, b),
5645														Test[] (a, b),
5646														Test[] (a, b) ) );
5647
5648				int z[100][101][102];
5649
5650				out0 = ivec2(x.length(), x[0].length());
5651				out1 = ivec3(y.length(), y[0].length(), y[0][0].length());
5652				out2 = ivec3(z.length(), z[0].length(), z[0][0].length());
5653				${OUTPUT}
5654			}
5655		""
5656	end
5657
5658	case mat3
5659		version 320 es
5660		desc "Testing the array length property with arrays of arrays"
5661		values
5662		{
5663			input ivec3 in0 = [ ivec3(0, 1, 2)];
5664			output ivec2 out0 = [ ivec2(3, 4) ];
5665			output ivec3 out1 = [ ivec3(1, 2, 4) ];
5666			output ivec3 out2 = [ ivec3(3, 101, 88) ];
5667		}
5668
5669		both ""
5670			#version 320 es
5671			precision mediump int;
5672			precision mediump float;
5673			${DECLARATIONS}
5674
5675			void main()
5676			{
5677				${SETUP}
5678
5679				mat3 a = mat3(	in0.x, in0.y, in0.z,
5680								in0.x, in0.y, in0.z,
5681								in0.x, in0.y, in0.z);
5682				mat3 b = mat3(	in0.z, in0.x, -in0.y,
5683								in0.z, in0.x, -in0.y,
5684								in0.z, in0.x, -in0.y);
5685				mat3 c = mat3(	-in0.z, -in0.z, in0.z,
5686								-in0.y, -in0.y, in0.y,
5687								-in0.x, -in0.x, in0.x);
5688
5689				mat3[3][4] x = mat3[][] (	mat3[] (a, a, a, a),
5690											mat3[] (b, b, b, b),
5691											mat3[] (c, c, c, c) );
5692
5693				mat3 y[][][] = mat3[][][] ( mat3[][] (	mat3[] (a, a, a, a),
5694														mat3[] (b, b, b, b) ) );
5695
5696
5697				mat3 z[3][101][88];
5698
5699				out0 = ivec2(x.length(), x[0].length());
5700				out1 = ivec3(y.length(), y[0].length(), y[0][0].length());
5701				out2 = ivec3(z.length(), z[0].length(), z[0][0].length());
5702				${OUTPUT}
5703			}
5704		""
5705	end
5706
5707	case constant_expression
5708		version 320 es
5709		desc "Testing the array length property with arrays of arrays"
5710		values
5711		{
5712			input ivec3 in0 = [ ivec3(0, 1, 2) ];
5713			output ivec3 out0 = [ ivec3(2, 7, 3) ];
5714		}
5715
5716		both ""
5717			#version 320 es
5718			precision mediump int;
5719			precision mediump float;
5720			${DECLARATIONS}
5721
5722			void main()
5723			{
5724				${SETUP}
5725
5726				int[] x[] = int[][] (	int[] (in0.z, in0.x, in0.y, in0.x, in0.y, in0.z, in0.x),
5727										int[] (in0.z, in0.x, in0.y, in0.x, in0.y, in0.z, in0.x) );
5728
5729				int[] y[][] = int[1][2][3] ( int[2][3] (		int[3] (in0.z, in0.x, in0.y),
5730															int[3] (in0.z, in0.x, in0.y) ));
5731
5732				int z[13][7][1];
5733
5734				int ret[x.length()][z[0].length()][y[0][0].length()];
5735				out0 = ivec3(ret.length(), ret[0].length(), ret[0][0].length());
5736				${OUTPUT}
5737			}
5738		""
5739	end
5740
5741end # length
5742
5743group array_access "Test accessing arrays of arrays"
5744
5745	case constant_expression_access
5746		version 320 es
5747		desc "Testing accessing arrays of arrays"
5748		values
5749		{
5750			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
5751			output vec3 out0 = [ vec3(-1.0, 0.5, -0.5) ];
5752		}
5753
5754		both ""
5755			#version 320 es
5756			precision mediump float;
5757			${DECLARATIONS}
5758
5759			const int a = 1;
5760
5761			void main ()
5762			{
5763				${SETUP}
5764				const int b = 2;
5765				float x = float[2][6] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5766										float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ) [a][a];
5767
5768				float y = float[][][] (	float[][] (		float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5769														float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5770										float[][] (		float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5771														float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5772										float[][] (		float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5773														float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5774										float[][] (		float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5775														float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5776										float[][] (		float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5777														float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) )) [b+2][b-1][b+1];
5778
5779				float z = float[][] (	float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z),
5780										float[] (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
5781										float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) ) [2][5];
5782
5783				out0 = vec3(x, y, z);
5784				${OUTPUT}
5785			}
5786		""
5787	end # constant_expression_access
5788
5789	case dynamic_expression_access
5790		version 320 es
5791		desc "Testing accessing arrays of arrays"
5792		values
5793		{
5794			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
5795			input ivec3 in1 = ivec3(3, 2, 1);
5796			output vec3 out0 = [ vec3(0.5, 2.0, -1.0) ];
5797		}
5798
5799		both ""
5800			#version 320 es
5801			precision mediump float;
5802			${DECLARATIONS}
5803
5804			void main ()
5805			{
5806				${SETUP}
5807				float x = float[2][6] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5808										float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ) [in1.z][in1.x];
5809
5810				float y = float[][][] (	float[][] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5811													float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5812										float[][] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5813													float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5814										float[][] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5815													float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5816										float[][] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5817													float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) ),
5818										float[][] ( float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
5819													float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z) )) [in1.x+1][in1.y-1][in1.z+4];
5820
5821				float z = float[][] (		float[] (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
5822										float[] (-in0.z, -in0.y, -in0.x, in0.x, in0.y, in0.z),
5823										float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) ) [in1.x-in1.y][in1.z];
5824
5825				out0 = vec3(x, y, z);
5826				${OUTPUT}
5827			}
5828		""
5829	end # dynamic_expression_access
5830
5831end # array_access
5832
5833
5834group single_statement_multiple_declarations "Testing multiple arrays of arrays declarations in a single statement"
5835
5836	group explicit_constructor "Testing single statement with multiple arrays of arrays with explicit constructor"
5837
5838		case float_2_dimensions
5839			version 320 es
5840			desc "Testing multiple two dimensional array declarations in a single statement"
5841			values
5842			{
5843				input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 0.2) | vec4(7.4, -1.0, 2.0, -1.3) | vec4(3.0, 1.6, -2.0, 0.5) ];
5844				output vec4 out0 = [ vec4(2.5, 0.7, 2.0, 2.5) | vec4(9.4, 6.1, -2.0, 9.4) | vec4(1.0, 3.5, 3.2, 1.0) ];
5845			}
5846
5847			both ""
5848				#version 320 es
5849				precision mediump float;
5850				${DECLARATIONS}
5851
5852				void main()
5853				{
5854					${SETUP}
5855					float[][] x = float[3][3] (	float[3] (in0.z, in0.x, in0.y),
5856												float[3] (in0.z, in0.x, in0.y),
5857												float[3] (in0.z, in0.x, in0.y) ),
5858
5859							  y = float[3][4] ( float[4] (in0.z, in0.x, in0.w, in0.y),
5860												float[4] (in0.z, in0.x, in0.w, in0.y),
5861												float[4] (in0.z, in0.x, in0.w, in0.y) );
5862
5863					out0 = vec4(x[0][0]+y[1][1], x[1][1]+y[2][2], x[2][2]+y[2][3], x[0][1]+y[0][0]);
5864					${OUTPUT}
5865				}
5866			""
5867		end
5868
5869		case int_3_dimensions
5870			version 320 es
5871			desc "Testing multiple three dimensional array declarations in a single statement"
5872			values
5873			{
5874				input ivec4 in0 = [ ivec4(0, 1, 2, 0) | ivec4(7, -1, 2, -1) | ivec4(3, 1, -2, 0) ];
5875				output ivec4 out0 = [ ivec4(2, 1, 2, 1) | ivec4(9, 6, 1, -2) | ivec4(1, 4, -2, 1) ];
5876			}
5877
5878			both ""
5879				#version 320 es
5880				precision mediump int;
5881				precision mediump float;
5882				${DECLARATIONS}
5883
5884				void main()
5885				{
5886					${SETUP}
5887					int[][][] x = int[4][4][4] (int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
5888															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5889															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5890															(int[4] (in0.z, in0.x, in0.w, in0.y))),
5891
5892												int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
5893															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5894															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5895															(int[4] (in0.z, in0.x, in0.w, in0.y))),
5896
5897												int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
5898															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5899															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5900															(int[4] (in0.z, in0.x, in0.w, in0.y))),
5901
5902												int[4][4] (	(int[4] (in0.z, in0.x, in0.w, in0.y)),
5903															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5904															(int[4] (in0.z, in0.x, in0.w, in0.y)),
5905															(int[4] (in0.z, in0.x, in0.w, in0.y))) ),
5906
5907							  y = int[2][2][4] (int[2][4] (	(int[4] (in0.x, in0.y, in0.z, in0.w)),
5908															(int[4] (in0.x, in0.y, in0.z, in0.w))),
5909
5910												int[2][4] (	(int[4] (in0.x, in0.y, in0.z, in0.w)),
5911															(int[4] (in0.x, in0.y, in0.z, in0.w))) );
5912
5913					out0 = ivec4(x[0][0][0] + y[0][0][0], x[1][1][1] + y[1][1][1], x[2][2][2] + y[0][0][2], x[3][3][3] + y[0][0][3]);
5914					${OUTPUT}
5915				}
5916			""
5917		end
5918
5919	end # explicit_constructor
5920
5921	group implicit_constructor "Testing single statement with multiple arrays of arrays with implicit constructor"
5922
5923		case float_2_dimensions
5924			version 320 es
5925			desc "Testing multiple two dimensional array declarations in a single statement"
5926			values
5927			{
5928				input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 0.2) | vec4(7.4, -1.0, 2.0, -1.3) | vec4(3.0, 1.6, -2.0, 0.5) ];
5929				output vec4 out0 = [ vec4(2.5, 0.7, 2.0, 2.5) | vec4(9.4, 6.1, -2.0, 9.4) | vec4(1.0, 3.5, 3.2, 1.0) ];
5930			}
5931
5932			both ""
5933				#version 320 es
5934				precision mediump float;
5935				${DECLARATIONS}
5936
5937				void main()
5938				{
5939					${SETUP}
5940					float[][] x = float[][] (float[] (in0.z, in0.x, in0.y),
5941											float[] (in0.z, in0.x, in0.y),
5942											float[] (in0.z, in0.x, in0.y) ),
5943
5944							  y = float[][] (float[] (in0.z, in0.x, in0.w, in0.y),
5945											float[] (in0.z, in0.x, in0.w, in0.y),
5946											float[] (in0.z, in0.x, in0.w, in0.y) );
5947
5948					out0 = vec4(x[0][0]+y[1][1], x[1][1]+y[2][2], x[2][2]+y[2][3], x[0][1]+y[0][0]);
5949					${OUTPUT}
5950				}
5951			""
5952		end
5953
5954		case int_3_dimensions
5955			version 320 es
5956			desc "Testing multiple three dimensional array declarations in a single statement"
5957			values
5958			{
5959				input ivec4 in0 = [ ivec4(0, 1, 2, 0) | ivec4(7, -1, 2, -1) | ivec4(3, 1, -2, 0) ];
5960				output ivec4 out0 = [ ivec4(2, 1, 2, 1) | ivec4(9, 6, 1, -2) | ivec4(1, 4, -2, 1) ];
5961			}
5962
5963			both ""
5964				#version 320 es
5965				precision mediump int;
5966				precision mediump float;
5967				${DECLARATIONS}
5968
5969				void main()
5970				{
5971					${SETUP}
5972					int[][][] x = int[][][] (int[][] (	(int[] (in0.z, in0.x, in0.w, in0.y)),
5973														(int[] (in0.z, in0.x, in0.w, in0.y)),
5974														(int[] (in0.z, in0.x, in0.w, in0.y)),
5975														(int[] (in0.z, in0.x, in0.w, in0.y))),
5976
5977											int[][] (	(int[] (in0.z, in0.x, in0.w, in0.y)),
5978														(int[] (in0.z, in0.x, in0.w, in0.y)),
5979														(int[] (in0.z, in0.x, in0.w, in0.y)),
5980														(int[] (in0.z, in0.x, in0.w, in0.y))),
5981
5982											int[][] (	(int[] (in0.z, in0.x, in0.w, in0.y)),
5983														(int[] (in0.z, in0.x, in0.w, in0.y)),
5984														(int[] (in0.z, in0.x, in0.w, in0.y)),
5985														(int[] (in0.z, in0.x, in0.w, in0.y))),
5986
5987											int[][] (	(int[] (in0.z, in0.x, in0.w, in0.y)),
5988														(int[] (in0.z, in0.x, in0.w, in0.y)),
5989														(int[] (in0.z, in0.x, in0.w, in0.y)),
5990														(int[] (in0.z, in0.x, in0.w, in0.y))) ),
5991
5992							  y = int[][][] (int[][] (	(int[] (in0.x, in0.y, in0.z, in0.w)),
5993														(int[] (in0.x, in0.y, in0.z, in0.w))),
5994
5995												int[][] ((int[] (in0.x, in0.y, in0.z, in0.w)),
5996														(int[] (in0.x, in0.y, in0.z, in0.w))) );
5997
5998					out0 = ivec4(x[0][0][0] + y[0][0][0], x[1][1][1] + y[1][1][1], x[2][2][2] + y[0][0][2], x[3][3][3] + y[0][0][3]);
5999					${OUTPUT}
6000				}
6001			""
6002		end
6003
6004	end # implicit_constructor
6005
6006end # single_statement_multiple_declarations
6007
6008
6009group invalid "Invalid functions"
6010
6011	case dynamic_expression_array_size
6012		version 320 es
6013		desc "Testing that compiler doesn't allow dynamic expressions in arrays of arrays sizes"
6014		expect compile_fail
6015
6016		both ""
6017			#version 320 es
6018			precision mediump float;
6019			${DECLARATIONS}
6020
6021			void main ()
6022			{
6023				int a = 5;
6024				float[a][a] array;
6025				${POSITION_FRAG_COLOR} = vec4(1.0);
6026			}
6027		""
6028	end # dynamic_expression_array_size
6029
6030	case empty_declaration_without_var_name
6031		version 320 es
6032		desc "Testing that compiler doesn't allow only an empty declaration"
6033		expect compile_or_link_fail
6034
6035		both ""
6036			#version 320 es
6037			precision mediump float;
6038			${DECLARATIONS}
6039
6040			void main ()
6041			{
6042				float[][];
6043				${POSITION_FRAG_COLOR} = vec4(1.0);
6044			}
6045		""
6046	end # empty_declaration_without_var_name
6047
6048	case empty_declaration_with_var_name
6049		version 320 es
6050		desc "Testing that compiler doesn't allow only an empty declaration"
6051		expect compile_or_link_fail
6052
6053		both ""
6054			#version 320 es
6055			precision mediump float;
6056			${DECLARATIONS}
6057
6058			void main ()
6059			{
6060				int[][] a;
6061				${POSITION_FRAG_COLOR} = vec4(1.0);
6062			}
6063		""
6064	end # empty_declaration_with_var_name
6065
6066	case uniform_block
6067		version 320 es
6068		desc "Testing that compiler doesn't allow arrays of arrays of uniform blocks"
6069		expect compile_or_link_fail
6070
6071		both ""
6072			#version 320 es
6073			precision mediump float;
6074			${DECLARATIONS}
6075
6076			layout(std140) uniform Transform {
6077				mat4 modelViewMatrix;
6078				mat4 modelViewProjectionMatrix;
6079				mat3 normalMatrix;
6080				float deformation;
6081			} TransformInstance [2][2];
6082
6083			void main ()
6084			{
6085				${POSITION_FRAG_COLOR} = vec4(1.0);
6086			}
6087		""
6088	end # uniform_block
6089
6090	case storage_block
6091		version 320 es
6092		desc "Testing that compiler doesn't allow arrays of arrays of SSBOs"
6093		expect compile_or_link_fail
6094
6095		both ""
6096			#version 320 es
6097			precision mediump float;
6098			${DECLARATIONS}
6099
6100			layout(std430) buffer Transform {
6101				mat4 modelViewMatrix;
6102				mat4 modelViewProjectionMatrix;
6103				mat3 normalMatrix;
6104				float deformation;
6105			} TransformInstance [2][2];
6106
6107			void main ()
6108			{
6109				${POSITION_FRAG_COLOR} = vec4(1.0);
6110			}
6111		""
6112	end # storage_block
6113
6114end # negative
6115