1#X1. Type: 					float[5] 								// An array type with 5 elements
2#X2. Return value:			float[5] func() { ... } 				// Function with a 5-element array return value
3#X3. Array constructor:		float[3] (1.0, 2.0, 5.5)				// 3-element array with given elements
4#																	// Fails with array of matrices!
5#X4. As unnamed parameter:	void func(float[5]);
6#X5. Variable declaration:	float[5] a;								// Equivalent to float a[5]; (?)
7#X6. Empty brackets:		float x[] = float[] (1.0, 2.0, 3.0);	// Size of x is 3
8#							float y[] = float[3] (1.0, 2.0, 3.0);	// Size of y is 3 (equivalent)
9#							float z[] = y;							// Size of z is 3
10#X7. Testing that 2-dimensional arrays don't work:	float a[5][3];	// Illegal
11#													float[5] a[3]; 	// Illegal
12#X8. Testing that array declaration with dynamic variables as array size won't work.
13#X9. Testing length() operator:	z.length(); 						// Returns 3 for z defined before
14#X10. Test C/C++ style {}-constructor
15#X11. Test struct arrays
16#X12. Test array element access at initialization with const/dynamic values
17
18group constructor "Array constructors"
19
20	case float3
21		version 300 es
22		values
23		{
24			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
25			output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
26		}
27
28		both ""
29			#version 300 es
30			precision mediump float;
31			${DECLARATIONS}
32
33			void main()
34			{
35				${SETUP}
36				float[3] x;
37				x = float[3] (in0.z, in0.x, in0.y);
38				out0 = vec3(x[0], x[1], x[2]);
39				${OUTPUT}
40			}
41		""
42	end
43
44	case float4
45		version 300 es
46		values
47		{
48			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) ];
49			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) ];
50		}
51
52		both ""
53			#version 300 es
54			precision mediump float;
55			${DECLARATIONS}
56
57			void main()
58			{
59				${SETUP}
60				float[4] x;
61				x = float[4] (in0.z, in0.x, in0.w, in0.y);
62				out0 = vec4(x[0], x[1], x[2], x[3]);
63				${OUTPUT}
64			}
65		""
66	end
67
68	case int3
69		version 300 es
70		values
71		{
72			input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
73			output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
74		}
75
76		both ""
77			#version 300 es
78			precision mediump int;
79			precision mediump float;
80			${DECLARATIONS}
81
82			void main()
83			{
84				${SETUP}
85				int[3] x;
86				x = int[3] (in0.z, in0.x, in0.y);
87				out0 = ivec3(x[0], x[1], x[2]);
88				${OUTPUT}
89			}
90		""
91	end
92
93	case int4
94		version 300 es
95		values
96		{
97			input ivec4 in0 = [ ivec4(0, 1, 2, 0) | ivec4(7, -1, 2, -1) | ivec4(3, 1, -2, 0) ];
98			output ivec4 out0 = [ ivec4(2, 0, 0, 1) | ivec4(2, 7, -1, -1) | ivec4(-2, 3, 0, 1) ];
99		}
100
101		both ""
102			#version 300 es
103			precision mediump int;
104			precision mediump float;
105			${DECLARATIONS}
106
107			void main()
108			{
109				${SETUP}
110				int[4] x;
111				x = int[4] (in0.z, in0.x, in0.w, in0.y);
112				out0 = ivec4(x[0], x[1], x[2], x[3]);
113				${OUTPUT}
114			}
115		""
116	end
117
118	case bool3
119		version 300 es
120		values
121		{
122			input bvec3 in0 = [ bvec3(true, true, false) ];
123			output bvec3 out0 = [ bvec3(false, true, true) ];
124		}
125
126		both ""
127			#version 300 es
128			precision mediump float;
129			${DECLARATIONS}
130
131			void main()
132			{
133				${SETUP}
134				bool[3] x;
135				x = bool[3] (in0.z, in0.x, in0.y);
136				out0 = bvec3(x[0], x[1], x[2]);
137				${OUTPUT}
138			}
139		""
140	end
141
142	case bool4
143		version 300 es
144		values
145		{
146			input bvec4 in0 = [ bvec4(true, true, false, false) ];
147			output bvec4 out0 = [ bvec4(false, true, true, false) ];
148		}
149
150		both ""
151			#version 300 es
152			precision mediump float;
153			${DECLARATIONS}
154
155			void main()
156			{
157				${SETUP}
158				bool[4] x;
159				x = bool[4] (in0.z, in0.x, in0.y, in0.w);
160				out0 = bvec4(x[0], x[1], x[2], x[3]);
161				${OUTPUT}
162			}
163		""
164	end
165
166	case struct3
167		version 300 es
168		values
169		{
170			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
171			output vec3 out0 = [ vec3(2.0, -0.5, -1.0) ];
172		}
173
174		both ""
175			#version 300 es
176			precision mediump float;
177			${DECLARATIONS}
178
179
180
181			void main()
182			{
183				${SETUP}
184
185				struct test
186				{
187					float f;
188					vec3 v;
189				};
190
191				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
192				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
193				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
194
195				test[3] x = test[3] (a, b, c);
196
197				out0 = vec3(x[0].f, x[1].v.y, x[2].v.x);
198				${OUTPUT}
199			}
200		""
201	end
202
203	case struct4
204		version 300 es
205		values
206		{
207			input vec4 in0 = [ vec4(0.5, 1.0, 2.0, 1.5) ];
208			output vec4 out0 = [ vec4(2.0, -0.5, -1.0, -1.5) ];
209		}
210
211		both ""
212			#version 300 es
213			precision mediump float;
214			${DECLARATIONS}
215
216
217			void main()
218			{
219				${SETUP}
220
221
222				struct test
223				{
224					float f;
225					vec3 v;
226				};
227
228				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
229				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
230				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
231				test d = test(-in0.w, vec3(-in0.w, -in0.x, -in0.z));
232
233				test[4] x = test[4] (a, b, c, d);
234
235				out0 = vec4(x[0].f, x[1].v.y, x[2].v.x, x[3].v.x);
236				${OUTPUT}
237			}
238		""
239	end
240
241
242	case float_vec3
243		version 300 es
244		values
245		{
246			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
247			output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(7.4, -2.0, -1.0) | vec3(3.0, 2.0, 1.6) ];
248		}
249
250		both ""
251			#version 300 es
252			precision mediump float;
253			${DECLARATIONS}
254
255			void main()
256			{
257				${SETUP}
258
259				vec3[3] x;
260				x = vec3[3] ( 	vec3(in0.x, in0.y, in0.z)	,
261								vec3(-in0.y, -in0.z, -in0.x),
262								vec3(in0.z, in0.x, in0.y)	);
263				out0 = vec3(x[0].x, x[1].y, x[2].z);
264				${OUTPUT}
265			}
266		""
267	end
268
269	case int_vec3
270		version 300 es
271		values
272		{
273			input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
274			output ivec3 out0 = [ ivec3(5, -2, 1) | ivec3(7, -2, -1) | ivec3(3, 2, 1) ];
275		}
276
277		both ""
278			#version 300 es
279			precision mediump int;
280			precision mediump float;
281			${DECLARATIONS}
282
283			void main()
284			{
285				${SETUP}
286
287				ivec3[3] x;
288				x = ivec3[3] ( 	ivec3(in0.x, in0.y, in0.z)	,
289								ivec3(-in0.y, -in0.z, -in0.x),
290								ivec3(in0.z, in0.x, in0.y)	);
291				out0 = ivec3(x[0].x, x[1].y, x[2].z);
292				${OUTPUT}
293			}
294		""
295	end
296
297	case bool_vec3
298		version 300 es
299		values
300		{
301			input bvec3 in0 = [ bvec3(true, false, true) ];
302			output bvec3 out0 = [ bvec3(true, true, false) ];
303		}
304
305		both ""
306			#version 300 es
307			precision mediump float;
308			${DECLARATIONS}
309
310			void main()
311			{
312				${SETUP}
313
314				bvec3[3] x;
315				x = bvec3[3] ( 	bvec3(in0.x, in0.y, in0.z)	,
316								bvec3(in0.y, in0.z, in0.x),
317								bvec3(in0.z, in0.x, in0.y)	);
318				out0 = bvec3(x[0].x, x[1].y, x[2].z);
319				${OUTPUT}
320			}
321		""
322	end
323
324	case float_mat3
325		version 300 es
326		values
327		{
328			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
329			output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
330		}
331
332		both ""
333			#version 300 es
334			precision mediump float;
335			${DECLARATIONS}
336
337			void main()
338			{
339				${SETUP}
340				mat3[3] a = mat3[3] (	mat3(	in0.x, in0.y, in0.z,
341												in0.x, in0.y, in0.z,
342												in0.x, in0.y, in0.z)	,
343										mat3(	in0.z, in0.x, -in0.y,
344												in0.z, in0.x, -in0.y,
345												in0.z, in0.x, -in0.y)	,
346										mat3(	-in0.z, -in0.z, in0.z,
347												-in0.y, -in0.y, in0.y,
348												-in0.x, -in0.x, in0.x)	);
349
350				mat3 a0 = a[0];
351				mat3 a1 = a[1];
352				mat3 a2 = a[2];
353
354				float ret0 = a0[2][0];
355				float ret1 = a1[0][2];
356				float ret2 = a2[1][2];
357
358				out0 = vec3(ret0, ret1, ret2);
359				${OUTPUT}
360			}
361		""
362	end
363
364	case int_mat3
365		version 300 es
366		values
367		{
368			input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
369			output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
370		}
371
372		both ""
373			#version 300 es
374			precision mediump int;
375			precision mediump float;
376			${DECLARATIONS}
377
378			void main()
379			{
380				${SETUP}
381				mat3[3] a = mat3[3] (	mat3(	in0.x, in0.y, in0.z,
382												in0.x, in0.y, in0.z,
383												in0.x, in0.y, in0.z)	,
384										mat3(	in0.z, in0.x, -in0.y,
385												in0.z, in0.x, -in0.y,
386												in0.z, in0.x, -in0.y)	,
387										mat3(	-in0.z, -in0.z, in0.z,
388												-in0.y, -in0.y, in0.y,
389												-in0.x, -in0.x, in0.x)	);
390
391				mat3 a0 = a[0];
392				mat3 a1 = a[1];
393				mat3 a2 = a[2];
394
395				float ret0 = a0[2][0];
396				float ret1 = a1[0][2];
397				float ret2 = a2[1][2];
398
399				out0 = ivec3(ret0, ret1, ret2);
400				${OUTPUT}
401			}
402		""
403	end
404
405	case bool_mat3
406		version 300 es
407		values
408		{
409			input bvec3 in0 = [ bvec3(true, false, true) ];
410			output bvec3 out0 = [ bvec3(true, false, false) ];
411		}
412
413		both ""
414			#version 300 es
415			precision mediump float;
416			${DECLARATIONS}
417
418			void main()
419			{
420				${SETUP}
421				mat3[3] a = mat3[3] (	mat3(	in0.x, in0.y, in0.z,
422												in0.x, in0.y, in0.z,
423												in0.x, in0.y, in0.z)	,
424										mat3(	in0.z, in0.x, in0.y,
425												in0.z, in0.x, in0.y,
426												in0.z, in0.x, in0.y)	,
427										mat3(	in0.z, in0.z, in0.z,
428												in0.y, in0.y, in0.y,
429												in0.x, in0.x, in0.x)	);
430
431				mat3 a0 = a[0];
432				mat3 a1 = a[1];
433				mat3 a2 = a[2];
434
435				float ret0 = a0[2][0];
436				float ret1 = a1[0][2];
437				float ret2 = a2[1][2];
438
439				out0 = bvec3(ret0, ret1, ret2);
440				${OUTPUT}
441			}
442		""
443	end
444
445end # type
446
447group return "Arrays as return value"
448
449	case float
450		version 300 es
451		values
452		{
453			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
454			output vec3 out0 = [ vec3(2.0, -0.5, 1.0) | vec3(2.0, -7.4, -1.0) | vec3(-2.0, -3.0, 1.6) ];
455		}
456
457		both ""
458			#version 300 es
459			precision mediump float;
460			${DECLARATIONS}
461
462			float[3] func(vec3 a)
463			{
464				return float[3] (a.z, -a.x, a.y);
465			}
466
467			void main()
468			{
469				${SETUP}
470				float[3] x = func(in0);
471				out0 = vec3(x[0], x[1], x[2]);
472				${OUTPUT}
473			}
474		""
475	end
476
477	case int
478		version 300 es
479		values
480		{
481			input ivec3 in0 = [ ivec3(4, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
482			output ivec3 out0 =	[ ivec3(2, -4, 1) | ivec3(2, -7, -1) | ivec3(-2, -3, 1) ];
483		}
484
485		both ""
486			#version 300 es
487			precision mediump int;
488			precision mediump float;
489			${DECLARATIONS}
490
491			int[3] func(ivec3 a)
492			{
493				return int[3] (a.z, -a.x, a.y);
494			}
495
496			void main()
497			{
498				${SETUP}
499				int[3] x = func(in0);
500				out0 = ivec3(x[0], x[1], x[2]);
501				${OUTPUT}
502			}
503		""
504	end
505
506	case bool
507		version 300 es
508		values
509		{
510			input bvec3 in0 = 	[ bvec3(false, true, true) ];
511			output bvec3 out0 = [ bvec3(true, false, true) ];
512		}
513
514		both ""
515			#version 300 es
516			precision mediump float;
517			${DECLARATIONS}
518
519			bool[3] func(bvec3 a)
520			{
521				return bool[3] (a.z, a.x, a.y);
522			}
523
524			void main()
525			{
526				${SETUP}
527				bool[3] x = func(in0);
528				out0 = bvec3(x[0], x[1], x[2]);
529				${OUTPUT}
530			}
531		""
532	end
533
534
535
536	case float_vec3
537		version 300 es
538		values
539		{
540			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
541			output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
542		}
543
544		both ""
545			#version 300 es
546			precision mediump float;
547			${DECLARATIONS}
548
549			vec3[3] func(vec3[3] a)
550			{
551				return vec3[3] (a[1], a[2], a[0]);
552			}
553
554			void main()
555			{
556				${SETUP}
557				vec3[3] x = vec3[3](vec3(in0.x, in0.y, -in0.z)	,
558									vec3(in0.y, -in0.z, in0.x)	,
559									vec3(-in0.z, in0.x, in0.y)	);
560				x = func(x);
561				out0 = vec3(x[0].x, x[1].y, x[2].z);
562				${OUTPUT}
563			}
564		""
565	end
566
567	case struct
568		version 300 es
569		values
570		{
571			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) ];
572			output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
573		}
574
575		both ""
576			#version 300 es
577			precision mediump float;
578			${DECLARATIONS}
579
580			struct test
581			{
582				float f;
583				vec3 v;
584			};
585
586			test[3] func(test[3] a)
587			{
588				return test[3] (a[1], a[2], a[0]);
589			}
590
591			void main()
592			{
593				${SETUP}
594
595				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
596				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
597				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
598
599				test[3] t = test[3] (a, b, c);
600				test[3] x = func(t);
601
602				out0 = vec3(x[0].v.z, x[1].v.y, x[2].v.x);
603				${OUTPUT}
604			}
605		""
606	end
607
608	case int_vec3
609		version 300 es
610		values
611		{
612			input ivec3 in0 = 	[ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
613			output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
614		}
615
616		both ""
617			#version 300 es
618			precision mediump int;
619			precision mediump float;
620			${DECLARATIONS}
621
622			ivec3[3] func(ivec3[3] a)
623			{
624				return ivec3[3] (a[1], a[2], a[0]);
625			}
626
627			void main()
628			{
629				${SETUP}
630				ivec3[3] x = ivec3[3](	ivec3(in0.x, in0.y, -in0.z)	,
631										ivec3(in0.y, -in0.z, in0.x)	,
632										ivec3(-in0.z, in0.x, in0.y)	);
633				x = func(x);
634				out0 = ivec3(x[0].x, x[1].y, x[2].z);
635				${OUTPUT}
636			}
637		""
638	end
639
640	case bool_vec3
641		version 300 es
642		values
643		{
644			input bvec3 in0 = 	[ bvec3(true, false, false) ];
645			output bvec3 out0 = [ bvec3(false, true, false) ];
646		}
647
648		both ""
649			#version 300 es
650			precision mediump int;
651			precision mediump float;
652			${DECLARATIONS}
653
654			bvec3[3] func(bvec3[3] a)
655			{
656				return bvec3[3] (a[1], a[2], a[0]);
657			}
658
659			void main()
660			{
661				${SETUP}
662				bvec3[3] x = bvec3[3](	bvec3(in0.x, in0.y, in0.z)	,
663										bvec3(in0.y, in0.z, in0.x)	,
664										bvec3(in0.z, in0.x, in0.y)	);
665				x = func(x);
666				out0 = bvec3(x[0].x, x[1].y, x[2].z);
667				${OUTPUT}
668			}
669		""
670	end
671
672	case float_mat3
673		version 300 es
674		values
675		{
676			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
677			output vec3 out0 = [ vec3(2.0, -1.0, 2.0) | vec3(-2.3, 0.0, -2.3) ];
678		}
679
680		both ""
681			#version 300 es
682			precision mediump float;
683			${DECLARATIONS}
684
685			mat3[3] func(mat3[3] x)
686			{
687				mat3[3] r;
688				r[0] = x[1];
689				r[1] = x[2];
690				r[2] = x[0];
691				return r;
692			}
693
694			void main()
695			{
696				${SETUP}
697				mat3[3] a, b;
698				a[0] = mat3(in0.x, in0.y, in0.z,
699							in0.x, in0.y, in0.z,
700							in0.x, in0.y, in0.z);
701				a[1] = mat3(in0.z, in0.x, -in0.y,
702							in0.z, in0.x, -in0.y,
703							in0.z, in0.x, -in0.y);
704				a[2] = mat3(-in0.z, -in0.z, in0.z,
705							-in0.y, -in0.y, in0.y,
706							-in0.x, -in0.x, in0.x);
707
708				b = func(a);
709
710				mat3 b0 = b[0];
711				mat3 b1 = b[1];
712				mat3 b2 = b[2];
713
714				float ret0 = b0[0][0];
715				float ret1 = b1[1][1];
716				float ret2 = b2[2][2];
717
718				out0 = vec3(ret0, ret1, ret2);
719				${OUTPUT}
720			}
721		""
722	end
723
724	case int_mat3
725		version 300 es
726		values
727		{
728			input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-1, 0, -2) ];
729			output ivec3 out0 = [ ivec3(2, -1, 2) | ivec3(-2, 0, -2) ];
730		}
731
732		both ""
733			#version 300 es
734			precision mediump int;
735			precision mediump float;
736			${DECLARATIONS}
737
738			mat3[3] func(mat3[3] x)
739			{
740				mat3[3] r;
741				r[0] = x[1];
742				r[1] = x[2];
743				r[2] = x[0];
744				return r;
745			}
746
747			void main()
748			{
749				${SETUP}
750				mat3[3] a, b;
751				a[0] = mat3(in0.x, in0.y, in0.z,
752							in0.x, in0.y, in0.z,
753							in0.x, in0.y, in0.z);
754				a[1] = mat3(in0.z, in0.x, -in0.y,
755							in0.z, in0.x, -in0.y,
756							in0.z, in0.x, -in0.y);
757				a[2] = mat3(-in0.z, -in0.z, in0.z,
758							-in0.y, -in0.y, in0.y,
759							-in0.x, -in0.x, in0.x);
760
761				b = func(a);
762
763				mat3 b0 = b[0];
764				mat3 b1 = b[1];
765				mat3 b2 = b[2];
766
767				float ret0 = b0[0][0];
768				float ret1 = b1[1][1];
769				float ret2 = b2[2][2];
770
771				out0 = ivec3(ret0, ret1, ret2);
772				${OUTPUT}
773			}
774		""
775	end
776
777	case bool_mat3
778		version 300 es
779		values
780		{
781			input bvec3 in0 = [ bvec3(true, false, true) | bvec3(true, true, false) ];
782			output bvec3 out0 = [ bvec3(true, false, true) | bvec3(false, true, false) ];
783		}
784
785		both ""
786			#version 300 es
787			precision mediump float;
788			${DECLARATIONS}
789
790			mat3[3] func(mat3[3] x)
791			{
792				mat3[3] r;
793				r[0] = x[1];
794				r[1] = x[2];
795				r[2] = x[0];
796				return r;
797			}
798
799			void main()
800			{
801				${SETUP}
802				mat3[3] a, b;
803				a[0] = mat3(in0.x, in0.y, in0.z,
804							in0.x, in0.y, in0.z,
805							in0.x, in0.y, in0.z);
806				a[1] = mat3(in0.z, in0.x, in0.y,
807							in0.z, in0.x, in0.y,
808							in0.z, in0.x, in0.y);
809				a[2] = mat3(in0.z, in0.z, in0.z,
810							in0.y, in0.y, in0.y,
811							in0.x, in0.x, in0.x);
812
813				b = func(a);
814
815				mat3 b0 = b[0];
816				mat3 b1 = b[1];
817				mat3 b2 = b[2];
818
819				float ret0 = b0[0][0];
820				float ret1 = b1[1][1];
821				float ret2 = b2[2][2];
822
823				out0 = bvec3(ret0, ret1, ret2);
824				${OUTPUT}
825			}
826		""
827	end
828
829end # return
830
831group unnamed_parameter "Array type as unnamed parameter of a function prototype"
832
833	case float
834		version 300 es
835		values
836		{
837			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
838			output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
839		}
840
841		both ""
842			#version 300 es
843			precision mediump float;
844			${DECLARATIONS}
845
846			float[3] func(float[3]);
847
848			void main()
849			{
850				${SETUP}
851				float[3] a = float[3] (in0.x, in0.y, in0.z);
852				float[3] b = func(a);
853				out0 = vec3(b[0], b[1], b[2]);
854				${OUTPUT}
855			}
856
857			float[3] func(float[3] a)
858			{
859				return float[3] (a[2], a[0], a[1]);
860			}
861
862		""
863	end
864
865	case int
866		version 300 es
867		values
868		{
869			input ivec3 in0 = 	[ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
870			output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
871		}
872
873		both ""
874			#version 300 es
875			precision mediump int;
876			precision mediump float;
877			${DECLARATIONS}
878
879			int[3] func(int[3]);
880
881			void main()
882			{
883				${SETUP}
884				int[3] a = int[3] (in0.x, in0.y, in0.z);
885				int[3] b = func(a);
886				out0 = ivec3(b[0], b[1], b[2]);
887				${OUTPUT}
888			}
889
890			int[3] func(int[3] a)
891			{
892				return int[3] (a[2], a[0], a[1]);
893			}
894
895		""
896	end
897
898	case bool
899		version 300 es
900		values
901		{
902			input bvec3 in0 = 	[ bvec3(false, true, true) ];
903			output bvec3 out0 = [ bvec3(true, false, true) ];
904		}
905
906		both ""
907			#version 300 es
908			precision mediump float;
909			${DECLARATIONS}
910
911			bool[3] func(bool[3]);
912
913			void main()
914			{
915				${SETUP}
916				bool[3] a = bool[3] (in0.x, in0.y, in0.z);
917				bool[3] b = func(a);
918				out0 = bvec3(b[0], b[1], b[2]);
919				${OUTPUT}
920			}
921
922			bool[3] func(bool[3] a)
923			{
924				return bool[3] (a[2], a[0], a[1]);
925			}
926
927		""
928	end
929
930	case struct
931		version 300 es
932		values
933		{
934			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) ];
935			output vec3 out0 = [ vec3(-1.0, 2.0, 0.5) ];
936		}
937
938		both ""
939			#version 300 es
940			precision mediump float;
941			${DECLARATIONS}
942
943			struct test
944			{
945				float f;
946				vec3 v;
947			};
948
949			test[3] func(test[3]);
950
951			void main()
952			{
953				${SETUP}
954
955				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
956				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
957				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
958
959				test[3] t = test[3] (a, b, c);
960				test[3] x = func(t);
961				out0 = vec3(x[0].v.z, x[1].v.y, x[2].v.x);
962				${OUTPUT}
963			}
964
965			test[3] func(test[3] a)
966			{
967				return test[3] (a[1], a[2], a[0]);
968			}
969
970		""
971	end
972
973	case float_vec3
974		version 300 es
975		values
976		{
977			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
978			output vec3 out0 = [ vec3(1.0, 0.5, -2.0) | vec3(11.2, -0.5, 1.0) ];
979		}
980
981		both ""
982			#version 300 es
983			precision mediump float;
984			${DECLARATIONS}
985
986			vec3[3] func(vec3[3]);
987
988			void main()
989			{
990				${SETUP}
991				vec3[3] x = vec3[3](vec3(in0.x, in0.y, -in0.z)	,
992									vec3(in0.y, -in0.z, in0.x)	,
993									vec3(-in0.z, in0.x, in0.y)	);
994				x = func(x);
995				out0 = vec3(x[0].x, x[1].y, x[2].z);
996				${OUTPUT}
997			}
998
999			vec3[3] func(vec3[3] a)
1000			{
1001				return vec3[3] (a[1], a[2], a[0]);
1002			}
1003		""
1004	end
1005
1006	case int_vec3
1007		version 300 es
1008		values
1009		{
1010			input ivec3 in0 = 	[ ivec3(5, 1, 2) | ivec3(-5, 11, -1) ];
1011			output ivec3 out0 = [ ivec3(1, 5, -2) | ivec3(11, -5, 1) ];
1012		}
1013
1014		both ""
1015			#version 300 es
1016			precision mediump int;
1017			precision mediump float;
1018			${DECLARATIONS}
1019
1020			ivec3[3] func(ivec3[3]);
1021
1022			void main()
1023			{
1024				${SETUP}
1025				ivec3[3] x = ivec3[3](	ivec3(in0.x, in0.y, -in0.z)	,
1026										ivec3(in0.y, -in0.z, in0.x)	,
1027										ivec3(-in0.z, in0.x, in0.y)	);
1028				x = func(x);
1029				out0 = ivec3(x[0].x, x[1].y, x[2].z);
1030				${OUTPUT}
1031			}
1032
1033			ivec3[3] func(ivec3[3] a)
1034			{
1035				return ivec3[3] (a[1], a[2], a[0]);
1036			}
1037		""
1038	end
1039
1040	case bool_vec3
1041		version 300 es
1042		values
1043		{
1044			input bvec3 in0 = 	[ bvec3(true, false, false) ];
1045			output bvec3 out0 = [ bvec3(false, true, false) ];
1046		}
1047
1048		both ""
1049			#version 300 es
1050			precision mediump int;
1051			precision mediump float;
1052			${DECLARATIONS}
1053
1054			bvec3[3] func(bvec3[3]);
1055
1056			void main()
1057			{
1058				${SETUP}
1059				bvec3[3] x = bvec3[3](	bvec3(in0.x, in0.y, in0.z)	,
1060										bvec3(in0.y, in0.z, in0.x)	,
1061										bvec3(in0.z, in0.x, in0.y)	);
1062				x = func(x);
1063				out0 = bvec3(x[0].x, x[1].y, x[2].z);
1064				${OUTPUT}
1065			}
1066
1067			bvec3[3] func(bvec3[3] a)
1068			{
1069				return bvec3[3] (a[1], a[2], a[0]);
1070			}
1071
1072		""
1073	end
1074
1075	case float_mat3
1076		version 300 es
1077		values
1078		{
1079			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
1080			output vec3 out0 = [ vec3(2.0, -1.0, 2.0) | vec3(-2.3, 0.0, -2.3) ];
1081		}
1082
1083		both ""
1084			#version 300 es
1085			precision mediump float;
1086			${DECLARATIONS}
1087
1088			mat3[3] func(mat3[3]);
1089
1090			void main()
1091			{
1092				${SETUP}
1093				mat3[3] a, b;
1094				a[0] = mat3(in0.x, in0.y, in0.z,
1095							in0.x, in0.y, in0.z,
1096							in0.x, in0.y, in0.z);
1097				a[1] = mat3(in0.z, in0.x, -in0.y,
1098							in0.z, in0.x, -in0.y,
1099							in0.z, in0.x, -in0.y);
1100				a[2] = mat3(-in0.z, -in0.z, in0.z,
1101							-in0.y, -in0.y, in0.y,
1102							-in0.x, -in0.x, in0.x);
1103
1104				b = func(a);
1105
1106				mat3 b0 = b[0];
1107				mat3 b1 = b[1];
1108				mat3 b2 = b[2];
1109
1110				float ret0 = b0[0][0];
1111				float ret1 = b1[1][1];
1112				float ret2 = b2[2][2];
1113
1114				out0 = vec3(ret0, ret1, ret2);
1115				${OUTPUT}
1116			}
1117
1118			mat3[3] func(mat3[3] x)
1119			{
1120				mat3[3] r;
1121				r[0] = x[1];
1122				r[1] = x[2];
1123				r[2] = x[0];
1124				return r;
1125			}
1126		""
1127	end
1128
1129	case int_mat3
1130		version 300 es
1131		values
1132		{
1133			input ivec3 in0 = [ ivec3(5, 1, 2) | ivec3(-1, 0, -2) ];
1134			output ivec3 out0 = [ ivec3(2, -1, 2) | ivec3(-2, 0, -2) ];
1135		}
1136
1137		both ""
1138			#version 300 es
1139			precision mediump int;
1140			precision mediump float;
1141			${DECLARATIONS}
1142
1143			mat3[3] func(mat3[3]);
1144
1145			void main()
1146			{
1147				${SETUP}
1148				mat3[3] a, b;
1149				a[0] = mat3(in0.x, in0.y, in0.z,
1150							in0.x, in0.y, in0.z,
1151							in0.x, in0.y, in0.z);
1152				a[1] = mat3(in0.z, in0.x, -in0.y,
1153							in0.z, in0.x, -in0.y,
1154							in0.z, in0.x, -in0.y);
1155				a[2] = mat3(-in0.z, -in0.z, in0.z,
1156							-in0.y, -in0.y, in0.y,
1157							-in0.x, -in0.x, in0.x);
1158
1159				b = func(a);
1160
1161				mat3 b0 = b[0];
1162				mat3 b1 = b[1];
1163				mat3 b2 = b[2];
1164
1165				float ret0 = b0[0][0];
1166				float ret1 = b1[1][1];
1167				float ret2 = b2[2][2];
1168
1169				out0 = ivec3(ret0, ret1, ret2);
1170				${OUTPUT}
1171			}
1172
1173			mat3[3] func(mat3[3] x)
1174			{
1175				mat3[3] r;
1176				r[0] = x[1];
1177				r[1] = x[2];
1178				r[2] = x[0];
1179				return r;
1180			}
1181		""
1182	end
1183
1184	case bool_mat3
1185		version 300 es
1186		values
1187		{
1188			input bvec3 in0 = [ bvec3(true, false, true) | bvec3(true, true, false) ];
1189			output bvec3 out0 = [ bvec3(true, false, true) | bvec3(false, true, false) ];
1190		}
1191
1192		both ""
1193			#version 300 es
1194			precision mediump float;
1195			${DECLARATIONS}
1196
1197			mat3[3] func(mat3[3]);
1198			void main()
1199			{
1200				${SETUP}
1201				mat3[3] a, b;
1202				a[0] = mat3(in0.x, in0.y, in0.z,
1203							in0.x, in0.y, in0.z,
1204							in0.x, in0.y, in0.z);
1205				a[1] = mat3(in0.z, in0.x, in0.y,
1206							in0.z, in0.x, in0.y,
1207							in0.z, in0.x, in0.y);
1208				a[2] = mat3(in0.z, in0.z, in0.z,
1209							in0.y, in0.y, in0.y,
1210							in0.x, in0.x, in0.x);
1211
1212				b = func(a);
1213
1214				mat3 b0 = b[0];
1215				mat3 b1 = b[1];
1216				mat3 b2 = b[2];
1217
1218				float ret0 = b0[0][0];
1219				float ret1 = b1[1][1];
1220				float ret2 = b2[2][2];
1221
1222				out0 = bvec3(ret0, ret1, ret2);
1223				${OUTPUT}
1224			}
1225
1226			mat3[3] func(mat3[3] x)
1227			{
1228				mat3[3] r;
1229				r[0] = x[1];
1230				r[1] = x[2];
1231				r[2] = x[0];
1232				return r;
1233			}
1234		""
1235	end
1236
1237end # unnamed_parameter
1238
1239group declaration "Declaring arrays"
1240
1241	case implicit_size_float
1242		version 300 es
1243		values
1244		{
1245			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(7.4, -1.0, 2.0) | vec3(3.0, 1.6, -2.0) ];
1246			output vec3 out0 = [ vec3(2.0, 0.5, 1.0) | vec3(2.0, 7.4, -1.0) | vec3(-2.0, 3.0, 1.6) ];
1247		}
1248
1249		both ""
1250			#version 300 es
1251			precision mediump float;
1252			${DECLARATIONS}
1253
1254			void main()
1255			{
1256				${SETUP}
1257				float[] x = float[] (in0.z, in0.x, in0.y);
1258				float[] y = x;
1259
1260				out0 = vec3(y[0], y[1], y[2]);
1261				${OUTPUT}
1262			}
1263		""
1264	end
1265
1266	case implicit_size_int
1267		version 300 es
1268		values
1269		{
1270			input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(7, -1, 2) | ivec3(3, 1, -2) ];
1271			output ivec3 out0 = [ ivec3(2, 0, 1) | ivec3(2, 7, -1) | ivec3(-2, 3, 1) ];
1272		}
1273
1274		both ""
1275			#version 300 es
1276			precision mediump int;
1277			precision mediump float;
1278			${DECLARATIONS}
1279
1280			void main()
1281			{
1282				${SETUP}
1283				int[] x = int[] (in0.z, in0.x, in0.y);
1284				int[] y = x;
1285
1286				out0 = ivec3(y[0], y[1], y[2]);
1287				${OUTPUT}
1288			}
1289		""
1290	end
1291
1292	case implicit_size_bool
1293		version 300 es
1294		values
1295		{
1296			input bvec3 in0 = [ bvec3(false, true, true) ];
1297			output bvec3 out0 = [ bvec3(true, false, true) ];
1298		}
1299
1300		both ""
1301			#version 300 es
1302			precision mediump float;
1303			${DECLARATIONS}
1304
1305			void main()
1306			{
1307				${SETUP}
1308				bool[] x = bool[] (in0.z, in0.x, in0.y);
1309				bool[] y = x;
1310
1311				out0 = bvec3(y[0], y[1], y[2]);
1312				${OUTPUT}
1313			}
1314		""
1315	end
1316
1317	case implicit_size_struct
1318		version 300 es
1319		values
1320		{
1321			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1322			output vec3 out0 = [ vec3(-1.0, -0.5, 2.0) ];
1323		}
1324
1325		both ""
1326			#version 300 es
1327			precision mediump float;
1328			${DECLARATIONS}
1329
1330			struct test
1331			{
1332				float f;
1333				vec3 v;
1334			};
1335
1336			void main()
1337			{
1338				${SETUP}
1339
1340				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
1341				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
1342				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
1343
1344				test[] x = test[] (c, b, a);
1345				test[] y = x;
1346
1347				out0 = vec3(y[0].v.x, y[1].v.y, y[2].v.z);
1348				${OUTPUT}
1349			}
1350		""
1351	end
1352
1353	case implicit_size_float_vec3
1354		version 300 es
1355		values
1356		{
1357			input vec3 in0 = 	[ vec3(0.5, 1.0, 2.0) | vec3(-0.5, 11.2, -1.0) ];
1358			output vec3 out0 = [ vec3(0.5, -2.0, 1.0) | vec3(-0.5, 1.0, 11.2) ];
1359		}
1360
1361		both ""
1362			#version 300 es
1363			precision mediump float;
1364			${DECLARATIONS}
1365
1366			void main()
1367			{
1368				${SETUP}
1369				vec3[] x = vec3[] (	vec3(in0.x, in0.y, -in0.z)	,
1370									vec3(in0.y, -in0.z, in0.x)	,
1371									vec3(-in0.z, in0.x, in0.y)	);
1372				vec3[] y = x;
1373				out0 = vec3(y[0].x, y[1].y, y[2].z);
1374				${OUTPUT}
1375			}
1376		""
1377	end
1378
1379	case implicit_size_int_ivec3
1380		version 300 es
1381		values
1382		{
1383			input ivec3 in0 = 	[ ivec3(0, 1, 2) | ivec3(5, 11, -1) ];
1384			output ivec3 out0 = [ ivec3(0, -2, 1) | ivec3(5, 1, 11) ];
1385		}
1386
1387		both ""
1388			#version 300 es
1389			precision mediump int;
1390			precision mediump float;
1391			${DECLARATIONS}
1392
1393			void main()
1394			{
1395				${SETUP}
1396				ivec3[] x = ivec3[] (	ivec3(in0.x, in0.y, -in0.z)	,
1397										ivec3(in0.y, -in0.z, in0.x)	,
1398										ivec3(-in0.z, in0.x, in0.y)	);
1399				ivec3[] y = x;
1400				out0 = ivec3(y[0].x, y[1].y, y[2].z);
1401				${OUTPUT}
1402			}
1403		""
1404	end
1405
1406	case implicit_size_bool_bvec3
1407		version 300 es
1408		values
1409		{
1410			input bvec3 in0 = 	[ bvec3(true, false, true) ];
1411			output bvec3 out0 = [ bvec3(true, true, false) ];
1412		}
1413
1414		both ""
1415			#version 300 es
1416			precision mediump float;
1417			${DECLARATIONS}
1418
1419			void main()
1420			{
1421				${SETUP}
1422				bvec3[] x = bvec3[] (	bvec3(in0.x, in0.y, in0.z)	,
1423										bvec3(in0.y, in0.z, in0.x)	,
1424										bvec3(in0.z, in0.x, in0.y)	);
1425				bvec3[] y = x;
1426				out0 = bvec3(y[0].x, y[1].y, y[2].z);
1427				${OUTPUT}
1428			}
1429		""
1430	end
1431
1432	case implicit_size_float_mat3
1433		version 300 es
1434		values
1435		{
1436			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) | vec3(-1.5, 0.0, -2.3) ];
1437			output vec3 out0 = [ vec3(0.5, -1.0, 1.0) | vec3(-1.5, 0.0, 0.0) ];
1438		}
1439
1440		both ""
1441			#version 300 es
1442			precision mediump float;
1443			${DECLARATIONS}
1444
1445			void main()
1446			{
1447				${SETUP}
1448				mat3[] a = mat3[] (	mat3(	in0.x, in0.y, in0.z,
1449											in0.x, in0.y, in0.z,
1450											in0.x, in0.y, in0.z)	,
1451									mat3(	in0.z, in0.x, -in0.y,
1452											in0.z, in0.x, -in0.y,
1453											in0.z, in0.x, -in0.y)	,
1454									mat3(	-in0.z, -in0.z, in0.z,
1455											-in0.y, -in0.y, in0.y,
1456											-in0.x, -in0.x, in0.x)	);
1457
1458				mat3 a0 = a[0];
1459				mat3 a1 = a[1];
1460				mat3 a2 = a[2];
1461
1462				float ret0 = a0[2][0];
1463				float ret1 = a1[0][2];
1464				float ret2 = a2[1][2];
1465
1466				out0 = vec3(ret0, ret1, ret2);
1467				${OUTPUT}
1468			}
1469		""
1470	end
1471
1472	case implicit_size_int_mat3
1473		version 300 es
1474		values
1475		{
1476			input ivec3 in0 = [ ivec3(0, 1, 2) | ivec3(-1, 0, -2) ];
1477			output ivec3 out0 = [ ivec3(0, -1, 1) | ivec3(-1, 0, 0) ];
1478		}
1479
1480		both ""
1481			#version 300 es
1482			precision mediump int;
1483			precision mediump float;
1484			${DECLARATIONS}
1485
1486			void main()
1487			{
1488				${SETUP}
1489				mat3[] a = mat3[] (	mat3(	in0.x, in0.y, in0.z,
1490											in0.x, in0.y, in0.z,
1491											in0.x, in0.y, in0.z)	,
1492									mat3(	in0.z, in0.x, -in0.y,
1493											in0.z, in0.x, -in0.y,
1494											in0.z, in0.x, -in0.y)	,
1495									mat3(	-in0.z, -in0.z, in0.z,
1496											-in0.y, -in0.y, in0.y,
1497											-in0.x, -in0.x, in0.x)	);
1498
1499				mat3 a0 = a[0];
1500				mat3 a1 = a[1];
1501				mat3 a2 = a[2];
1502
1503				float ret0 = a0[2][0];
1504				float ret1 = a1[0][2];
1505				float ret2 = a2[1][2];
1506
1507				out0 = ivec3(ret0, ret1, ret2);
1508				${OUTPUT}
1509			}
1510		""
1511	end
1512
1513	case implicit_size_bool_mat3
1514		version 300 es
1515		values
1516		{
1517			input bvec3 in0 = [ bvec3(true, false, true) ];
1518			output bvec3 out0 = [ bvec3(true, false, false) ];
1519		}
1520
1521		both ""
1522			#version 300 es
1523			precision mediump float;
1524			${DECLARATIONS}
1525
1526			void main()
1527			{
1528				${SETUP}
1529				mat3[] a = mat3[] (	mat3(	in0.x, in0.y, in0.z,
1530											in0.x, in0.y, in0.z,
1531											in0.x, in0.y, in0.z)	,
1532									mat3(	in0.z, in0.x, in0.y,
1533											in0.z, in0.x, in0.y,
1534											in0.z, in0.x, in0.y)	,
1535									mat3(	in0.z, in0.z, in0.z,
1536											in0.y, in0.y, in0.y,
1537											in0.x, in0.x, in0.x)	);
1538
1539				mat3 a0 = a[0];
1540				mat3 a1 = a[1];
1541				mat3 a2 = a[2];
1542
1543				float ret0 = a0[2][0];
1544				float ret1 = a1[0][2];
1545				float ret2 = a2[1][2];
1546
1547				out0 = bvec3(ret0, ret1, ret2);
1548				${OUTPUT}
1549			}
1550		""
1551	end
1552
1553
1554	case constant_expression_array_size
1555		version 300 es
1556
1557		both ""
1558			#version 300 es
1559			precision mediump float;
1560			${DECLARATIONS}
1561
1562			const int a = 4;
1563
1564			void main ()
1565			{
1566				const int b = 5;
1567				float[a] array1;
1568				float[b] array2;
1569				float[array1.length()] array3;
1570				float[a+b] array4;
1571				${OUTPUT}
1572			}
1573		""
1574	end
1575
1576	case constant_expression_array_access
1577		version 300 es
1578		values
1579		{
1580			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1581			output vec3 out0 = [ vec3(-2.0, -1.0, -0.5) ];
1582		}
1583
1584		both ""
1585			#version 300 es
1586			precision mediump float;
1587			${DECLARATIONS}
1588
1589			const int a = 3;
1590
1591			void main ()
1592			{
1593				${SETUP}
1594				const int b = 2;
1595				float x = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [a];
1596				float y = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [b+2];
1597				float z = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [5];
1598				out0 = vec3(x, y, z);
1599				${OUTPUT}
1600			}
1601		""
1602	end
1603
1604	case dynamic_expression_array_access
1605		version 300 es
1606		values
1607		{
1608			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1609			input ivec2 in1 = ivec2(3, 2);
1610			output vec3 out0 = [ vec3(-2.0, -1.0, -0.5) ];
1611		}
1612
1613		both ""
1614			#version 300 es
1615			precision mediump float;
1616			${DECLARATIONS}
1617
1618			void main ()
1619			{
1620				${SETUP}
1621				float x = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [in1.x];
1622				float y = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [in1.y+2];
1623				float z = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [in1.x+in1.y];
1624				out0 = vec3(x, y, z);
1625				${OUTPUT}
1626			}
1627		""
1628	end
1629
1630	case multiple_declarations_single_statement_explicit
1631		version 300 es
1632		values
1633		{
1634			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1635			output vec3 out0 = [ vec3(2.0, -1.0, 0.5) ];
1636		}
1637
1638		both ""
1639			#version 300 es
1640			precision mediump float;
1641			${DECLARATIONS}
1642
1643			void main ()
1644			{
1645				${SETUP}
1646				float[] x = float[6] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
1647						y = float[2] (in0.x, -in0.y);
1648				out0 = vec3(x[2], y[1], x[0]);
1649				${OUTPUT}
1650			}
1651		""
1652	end
1653
1654	case multiple_declarations_single_statement_implicit
1655		version 300 es
1656		values
1657		{
1658			input ivec3 in0 = [ ivec3(5, 1, 2) ];
1659			output ivec3 out0 = [ ivec3(2, -1, 5) ];
1660		}
1661
1662		both ""
1663			#version 300 es
1664			precision mediump float;
1665			${DECLARATIONS}
1666
1667			void main ()
1668			{
1669				${SETUP}
1670				int[] x = int[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x),
1671					  y = int[] (in0.x, -in0.y);
1672				out0 = ivec3(x[2], y[1], x[0]);
1673				${OUTPUT}
1674			}
1675		""
1676	end
1677
1678end # declaration
1679
1680group length "Array length method"
1681
1682	case float
1683		version 300 es
1684		values
1685		{
1686			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1687			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1688		}
1689
1690		both ""
1691			#version 300 es
1692			precision mediump float;
1693			${DECLARATIONS}
1694
1695			void main()
1696			{
1697				${SETUP}
1698				float[] x = float[3] (in0.z, in0.x, in0.y);
1699				float[] y = float[] (in0.z, in0.x, in0.y, in0.x, in0.y);
1700				float[13] z;
1701
1702				out0 = ivec3(x.length(), y.length(), z.length());
1703				${OUTPUT}
1704			}
1705		""
1706	end
1707
1708	case int
1709		version 300 es
1710		values
1711		{
1712			input ivec3 in0 = [ ivec3(0, 1, 2) ];
1713			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1714		}
1715
1716		both ""
1717			#version 300 es
1718			precision mediump int;
1719			precision mediump float;
1720			${DECLARATIONS}
1721
1722			void main()
1723			{
1724				${SETUP}
1725				int[] x = int[3] (in0.z, in0.x, in0.y);
1726				int[] y = int[] (in0.z, in0.x, in0.y, in0.x, in0.y);
1727				int[13] z;
1728
1729				out0 = ivec3(x.length(), y.length(), z.length());
1730				${OUTPUT}
1731			}
1732		""
1733	end
1734
1735	case bool
1736		version 300 es
1737		values
1738		{
1739			input bvec3 in0 = [ bvec3(true, false, true) ];
1740			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1741		}
1742
1743		both ""
1744			#version 300 es
1745			precision mediump float;
1746			${DECLARATIONS}
1747
1748			void main()
1749			{
1750				${SETUP}
1751				bool[] x = bool[3] (in0.z, in0.x, in0.y);
1752				bool[] y = bool[] (in0.z, in0.x, in0.y, in0.x, in0.y);
1753				bool[13] z;
1754
1755				out0 = ivec3(x.length(), y.length(), z.length());
1756				${OUTPUT}
1757			}
1758		""
1759	end
1760
1761	case struct
1762		version 300 es
1763		values
1764		{
1765			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1766			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1767		}
1768
1769		both ""
1770			#version 300 es
1771			precision mediump float;
1772			${DECLARATIONS}
1773
1774			struct test
1775			{
1776				float f;
1777				vec3 v;
1778			};
1779
1780			void main()
1781			{
1782				${SETUP}
1783
1784				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
1785				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
1786				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
1787
1788				test[] x = test[3] (a, b, c);
1789				test[] y = test[] (c, a, b, b, a);
1790				test[13] z;
1791
1792				out0 = ivec3(x.length(), y.length(), z.length());
1793				${OUTPUT}
1794			}
1795		""
1796	end
1797
1798end # length
1799
1800group invalid "Invalid Functions"
1801
1802	case multidimensional_array1
1803		version 300 es
1804		expect compile_fail
1805
1806		both ""
1807			#version 300 es
1808			precision mediump float;
1809			${DECLARATIONS}
1810
1811			void main ()
1812			{
1813				float a[5][3];
1814				${POSITION_FRAG_COLOR} = vec4(1.0);
1815			}
1816		""
1817	end
1818
1819	case multidimensional_array2
1820		version 300 es
1821		expect compile_fail
1822
1823		both ""
1824			#version 300 es
1825			precision mediump float;
1826			${DECLARATIONS}
1827
1828			void main ()
1829			{
1830				float[5] a[3];
1831				${POSITION_FRAG_COLOR} = vec4(1.0);
1832			}
1833		""
1834	end
1835
1836	case multidimensional_uniform_array
1837		version 300 es
1838		expect compile_fail
1839
1840		both ""
1841			#version 300 es
1842			precision mediump float;
1843			${DECLARATIONS}
1844			uniform float a[3][2];
1845
1846			void main ()
1847			{
1848				${POSITION_FRAG_COLOR} = vec4(1.0);
1849			}
1850		""
1851	end
1852
1853	case multidimensional_array_in_uniform_block
1854		version 300 es
1855		expect compile_fail
1856
1857		both ""
1858			#version 300 es
1859			precision mediump float;
1860			${DECLARATIONS}
1861			uniform MyBlock
1862			{
1863				float a[3][2];
1864			};
1865
1866			void main ()
1867			{
1868				${POSITION_FRAG_COLOR} = vec4(1.0);
1869			}
1870		""
1871	end
1872
1873	case dynamic_expression_array_size
1874		version 300 es
1875		expect compile_fail
1876
1877		both ""
1878			#version 300 es
1879			precision mediump float;
1880			${DECLARATIONS}
1881
1882			void main ()
1883			{
1884				int a = 5;
1885				float[a] array;
1886				${POSITION_FRAG_COLOR} = vec4(1.0);
1887			}
1888		""
1889	end
1890
1891	case empty_declaration_without_var_name
1892		version 300 es
1893		expect compile_or_link_fail
1894
1895		both ""
1896			#version 300 es
1897			precision mediump float;
1898			${DECLARATIONS}
1899
1900			void main ()
1901			{
1902				int[];
1903				${POSITION_FRAG_COLOR} = vec4(1.0);
1904			}
1905		""
1906	end
1907
1908	case empty_declaration_with_var_name
1909		version 300 es
1910		expect compile_or_link_fail
1911
1912		both ""
1913			#version 300 es
1914			precision mediump float;
1915			${DECLARATIONS}
1916
1917			void main ()
1918			{
1919				int[] a;
1920				${POSITION_FRAG_COLOR} = vec4(1.0);
1921			}
1922		""
1923	end
1924
1925	case constructor_c_style1
1926		version 300 es
1927		expect compile_fail
1928
1929		both ""
1930			#version 300 es
1931			precision mediump float;
1932			${DECLARATIONS}
1933
1934			void main ()
1935			{
1936				float a[];
1937				a = float[3] { 1.0, 2.0, 3.0 };
1938
1939				${POSITION_FRAG_COLOR} = vec4(1.0);
1940			}
1941		""
1942	end
1943
1944	case constructor_c_style2
1945		version 300 es
1946		expect compile_fail
1947
1948		both ""
1949			#version 300 es
1950			precision mediump float;
1951			${DECLARATIONS}
1952
1953			void main ()
1954			{
1955				float a[5] = { 1.0, 2.0, 3.0 };
1956
1957				${POSITION_FRAG_COLOR} = vec4(1.0);
1958			}
1959		""
1960	end
1961
1962	case constructor_c_style3
1963		version 300 es
1964		expect compile_fail
1965
1966		both ""
1967			#version 300 es
1968			precision mediump float;
1969			${DECLARATIONS}
1970
1971			void main ()
1972			{
1973				float a[] = float[3] { 1.0, 2.0, 3.0 };
1974
1975				${POSITION_FRAG_COLOR} = vec4(1.0);
1976			}
1977		""
1978	end
1979
1980	case constructor_c_style4
1981		version 300 es
1982		expect compile_fail
1983
1984		both ""
1985			#version 300 es
1986			precision mediump float;
1987			${DECLARATIONS}
1988
1989			void main ()
1990			{
1991				float a[3] = { 1.0, 2.0, 3.0 };
1992
1993				${POSITION_FRAG_COLOR} = vec4(1.0);
1994			}
1995		""
1996	end
1997
1998end # invalid
1999