• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
18 group constructor "Array constructors"
19 
20 	case float3
21 		version 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 
445 end # type
446 
447 group return "Arrays as return value"
448 
449 	case float
450 		version 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 
829 end # return
830 
831 group unnamed_parameter "Array type as unnamed parameter of a function prototype"
832 
833 	case float
834 		version 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 
1237 end # unnamed_parameter
1238 
1239 group declaration "Declaring arrays"
1240 
1241 	case implicit_size_float
1242 		version 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
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 330
1556 
1557 		both ""
1558 			#version 330
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 330
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 330
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 
1605 
1606 	case dynamic_expression_array_access
1607 		version 330
1608 		values
1609 		{
1610 			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1611 			input ivec2 in1 = ivec2(3, 2);
1612 			output vec3 out0 = [ vec3(-2.0, -1.0, -0.5) ];
1613 		}
1614 
1615 		both ""
1616 			#version 330
1617 			precision mediump float;
1618 			${DECLARATIONS}
1619 
1620 			void main ()
1621 			{
1622 				${SETUP}
1623 				float x = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [in1.x];
1624 				float y = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [in1.y+2];
1625 				float z = float[] (in0.x, in0.y, in0.z, -in0.z, -in0.y, -in0.x) [in1.x+in1.y];
1626 				out0 = vec3(x, y, z);
1627 				${OUTPUT}
1628 			}
1629 		""
1630 	end
1631 
1632 end # declaration
1633 
1634 group length "Array length method"
1635 
1636 	case float
1637 		version 330
1638 		values
1639 		{
1640 			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1641 			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1642 		}
1643 
1644 		both ""
1645 			#version 330
1646 			precision mediump float;
1647 			${DECLARATIONS}
1648 
1649 			void main()
1650 			{
1651 				${SETUP}
1652 				float[] x = float[3] (in0.z, in0.x, in0.y);
1653 				float[] y = float[] (in0.z, in0.x, in0.y, in0.x, in0.y);
1654 				float[13] z;
1655 
1656 				out0 = ivec3(x.length(), y.length(), z.length());
1657 				${OUTPUT}
1658 			}
1659 		""
1660 	end
1661 
1662 	case int
1663 		version 330
1664 		values
1665 		{
1666 			input ivec3 in0 = [ ivec3(0, 1, 2) ];
1667 			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1668 		}
1669 
1670 		both ""
1671 			#version 330
1672 			precision mediump int;
1673 			precision mediump float;
1674 			${DECLARATIONS}
1675 
1676 			void main()
1677 			{
1678 				${SETUP}
1679 				int[] x = int[3] (in0.z, in0.x, in0.y);
1680 				int[] y = int[] (in0.z, in0.x, in0.y, in0.x, in0.y);
1681 				int[13] z;
1682 
1683 				out0 = ivec3(x.length(), y.length(), z.length());
1684 				${OUTPUT}
1685 			}
1686 		""
1687 	end
1688 
1689 	case bool
1690 		version 330
1691 		values
1692 		{
1693 			input bvec3 in0 = [ bvec3(true, false, true) ];
1694 			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1695 		}
1696 
1697 		both ""
1698 			#version 330
1699 			precision mediump float;
1700 			${DECLARATIONS}
1701 
1702 			void main()
1703 			{
1704 				${SETUP}
1705 				bool[] x = bool[3] (in0.z, in0.x, in0.y);
1706 				bool[] y = bool[] (in0.z, in0.x, in0.y, in0.x, in0.y);
1707 				bool[13] z;
1708 
1709 				out0 = ivec3(x.length(), y.length(), z.length());
1710 				${OUTPUT}
1711 			}
1712 		""
1713 	end
1714 
1715 	case struct
1716 		version 330
1717 		values
1718 		{
1719 			input vec3 in0 = [ vec3(0.5, 1.0, 2.0) ];
1720 			output ivec3 out0 = [ ivec3(3, 5, 13) ];
1721 		}
1722 
1723 		both ""
1724 			#version 330
1725 			precision mediump float;
1726 			${DECLARATIONS}
1727 
1728 			struct test
1729 			{
1730 				float f;
1731 				vec3 v;
1732 			};
1733 
1734 			void main()
1735 			{
1736 				${SETUP}
1737 
1738 				test a = test(in0.z, vec3(in0.x, in0.y, in0.z));
1739 				test b = test(in0.y, vec3(-in0.z, -in0.x, -in0.y));
1740 				test c = test(in0.x, vec3(-in0.y, in0.z, -in0.x));
1741 
1742 				test[] x = test[3] (a, b, c);
1743 				test[] y = test[] (c, a, b, b, a);
1744 				test[13] z;
1745 
1746 				out0 = ivec3(x.length(), y.length(), z.length());
1747 				${OUTPUT}
1748 			}
1749 		""
1750 	end
1751 
1752 end # length
1753 
1754 group invalid "Invalid Functions"
1755 
1756 	case multidimensional_array1
1757 		version 330
1758 		expect compile_fail
1759 
1760 		both ""
1761 			#version 330
1762 			precision mediump float;
1763 			${DECLARATIONS}
1764 
1765 			void main ()
1766 			{
1767 				float a[5][3];
1768 				${POSITION_FRAG_COLOR} = vec4(1.0);
1769 			}
1770 		""
1771 	end
1772 
1773 	case multidimensional_array2
1774 		version 330
1775 		expect compile_fail
1776 
1777 		both ""
1778 			#version 330
1779 			precision mediump float;
1780 			${DECLARATIONS}
1781 
1782 			void main ()
1783 			{
1784 				float[5] a[3];
1785 				${POSITION_FRAG_COLOR} = vec4(1.0);
1786 			}
1787 		""
1788 	end
1789 
1790 	case dynamic_expression_array_size
1791 		version 330
1792 		expect compile_fail
1793 
1794 		both ""
1795 			#version 330
1796 			precision mediump float;
1797 			${DECLARATIONS}
1798 
1799 			void main ()
1800 			{
1801 				int a = 5;
1802 				float[a] array;
1803 				${POSITION_FRAG_COLOR} = vec4(1.0);
1804 			}
1805 		""
1806 	end
1807 
1808 
1809 	case constructor_c-style1
1810 		version 330
1811 		expect compile_fail
1812 
1813 		both ""
1814 			#version 330
1815 			precision mediump float;
1816 			${DECLARATIONS}
1817 
1818 			void main ()
1819 			{
1820 				float a[];
1821 				a = float[3] { 1.0, 2.0, 3.0 };
1822 
1823 				${POSITION_FRAG_COLOR} = vec4(1.0);
1824 			}
1825 		""
1826 	end
1827 
1828 	case constructor_c-style2
1829 		version 330
1830 		expect compile_fail
1831 
1832 		both ""
1833 			#version 330
1834 			precision mediump float;
1835 			${DECLARATIONS}
1836 
1837 			void main ()
1838 			{
1839 				float a[5] = { 1.0, 2.0, 3.0 };
1840 
1841 				${POSITION_FRAG_COLOR} = vec4(1.0);
1842 			}
1843 		""
1844 	end
1845 
1846 end # invalid
1847