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