tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

functions.test (55713B)


      1 # Tests todo:
      2 # - inout with varyings, attributes, uniforms (and arrays of 'em)
      3 # - inout with arrays, array elements
      4 # - inout with array elements
      5 # - inout by-value semantics (arrays & elements & structs)
      6 
      7 # Done:
      8 # - control flow: return, return in loop, etc.
      9 
     10 group datatypes "Function Parameter Data Types"
     11 
     12 	case float_float
     13 		values
     14 		{
     15 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
     16 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
     17 		}
     18 
     19 		both ""
     20 			precision mediump float;
     21 			${DECLARATIONS}
     22 
     23 			float func (float a)
     24 			{
     25 				return -a;
     26 			}
     27 
     28 			void main()
     29 			{
     30 				out0 = func(in0);
     31 				${OUTPUT}
     32 			}
     33 		""
     34 	end
     35 
     36 	case float_vec2
     37 		values
     38 		{
     39 			input vec2 in0		= [ vec2(0.0, 1.0) | vec2(2.0, 2.5) ];
     40 			output float out0	= [ -1.0 | -4.5 ];
     41 		}
     42 
     43 		both ""
     44 			precision mediump float;
     45 			${DECLARATIONS}
     46 
     47 			float func (vec2 a)
     48 			{
     49 				return -(a.x + a.y);
     50 			}
     51 
     52 			void main()
     53 			{
     54 				out0 = func(in0);
     55 				${OUTPUT}
     56 			}
     57 		""
     58 	end
     59 
     60 	case float_vec3
     61 		values
     62 		{
     63 			input vec3 in0		= [ vec3(0.0, 1.0, -2.0) | vec3(2.0, 2.5, -4.0) ];
     64 			output float out0	= [ 1.0 | -0.5 ];
     65 		}
     66 
     67 		both ""
     68 			precision mediump float;
     69 			${DECLARATIONS}
     70 
     71 			float func (vec3 a)
     72 			{
     73 				return -(a.x + a.y + a.z);
     74 			}
     75 
     76 			void main()
     77 			{
     78 				out0 = func(in0);
     79 				${OUTPUT}
     80 			}
     81 		""
     82 	end
     83 
     84 	case float_vec4
     85 		values
     86 		{
     87 			input vec4 in0		= [ vec4(0.0, 1.0, -2.0, 0.5) | vec4(2.0, 2.5, 4.0, -7.0) ];
     88 			output float out0	= [ 0.5 | -1.5 ];
     89 		}
     90 
     91 		both ""
     92 			precision mediump float;
     93 			${DECLARATIONS}
     94 
     95 			float func (vec4 a)
     96 			{
     97 				return -(a.x + a.y + a.z + a.w);
     98 			}
     99 
    100 			void main()
    101 			{
    102 				out0 = func(in0);
    103 				${OUTPUT}
    104 			}
    105 		""
    106 	end
    107 
    108 	case float_mat2
    109 		values
    110 		{
    111 			input mat2 in0		= mat2(0.5, -1.0, 0.2, -1.0);
    112 			output float out0	= 0.5;
    113 		}
    114 
    115 		both ""
    116 			precision mediump float;
    117 			${DECLARATIONS}
    118 
    119 			float func (mat2 a)
    120 			{
    121 				//return -(a[0][0] + a[0][1] + a[1][0] + a[1][1]);
    122 				return a[0][0];
    123 			}
    124 
    125 			void main()
    126 			{
    127 				out0 = func(in0);
    128 				${OUTPUT}
    129 			}
    130 		""
    131 	end
    132 
    133 	case float_mat3
    134 		values
    135 		{
    136 			input mat3 in0		= [ mat3(0.0, 1.0, -2.0, 0.5, 1.0, -1.0, 2.0, 4.0, -1.0) | mat3(2.0, 2.5, 4.0, -7.0, 2.5, 3.0, 0.5, -3.5, 1.0) ];
    137 			output float out0	= [ -4.5 | -5.0 ];
    138 		}
    139 
    140 		both ""
    141 			precision mediump float;
    142 			${DECLARATIONS}
    143 
    144 			float func (mat3 a)
    145 			{
    146 				return -(a[0][0] + a[0][1] + a[0][2] + a[1][0] + a[1][1] + a[1][2] + a[2][0] + a[2][1] + a[2][2]);
    147 			}
    148 
    149 			void main()
    150 			{
    151 				out0 = func(in0);
    152 				${OUTPUT}
    153 			}
    154 		""
    155 	end
    156 
    157 	case float_mat4
    158 		values
    159 		{
    160 			input mat4 in0		= [ mat4(0.0, 1.0, -2.0, 0.5, 1.0, -1.0, 2.0, 4.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -2.0, -2.0) | mat4(2.0, 2.5, 4.0, -7.0, 2.5, 3.0, 0.5, -3.5, 1.0, 0.0, 2.0, -1.0, 1.0, 0.0, -1.0, 3.0) ];
    161 			output float out0	= [ -5.5 | -9.0 ];
    162 		}
    163 
    164 		both ""
    165 			precision mediump float;
    166 			${DECLARATIONS}
    167 
    168 			float func (mat4 a)
    169 			{
    170 				return -(a[0][0] + a[0][1] + a[0][2] + a[0][3] + a[1][0] + a[1][1] + a[1][2] + a[1][3] + a[2][0] + a[2][1] + a[2][2] + a[2][3] + a[3][0] + a[3][1] + a[3][2] + a[3][3]);
    171 			}
    172 
    173 			void main()
    174 			{
    175 				out0 = func(in0);
    176 				${OUTPUT}
    177 			}
    178 		""
    179 	end
    180 
    181 	case int_int
    182 		values
    183 		{
    184 			input int in0		= [ -1 | 0 | 1 | 4 ];
    185 			output int out0		= [ 1 | 0 | -1 | -4 ];
    186 		}
    187 
    188 		both ""
    189 			precision mediump float;
    190 			precision mediump int;
    191 			${DECLARATIONS}
    192 
    193 			int func (int a)
    194 			{
    195 				return -a;
    196 			}
    197 
    198 			void main()
    199 			{
    200 				${SETUP}
    201 				out0 = func(in0);
    202 				${OUTPUT}
    203 			}
    204 		""
    205 	end
    206 
    207 	case int_ivec2
    208 		values
    209 		{
    210 			input ivec2 in0		= [ ivec2(-1, 0) | ivec2(1, 4) ];
    211 			output int out0		= [ 1 | -5 ];
    212 		}
    213 
    214 		both ""
    215 			precision mediump float;
    216 			precision mediump int;
    217 			${DECLARATIONS}
    218 
    219 			int func (ivec2 a)
    220 			{
    221 				return -(a.x + a.y);
    222 			}
    223 
    224 			void main()
    225 			{
    226 				${SETUP}
    227 				out0 = func(in0);
    228 				${OUTPUT}
    229 			}
    230 		""
    231 	end
    232 
    233 	case int_ivec3
    234 		values
    235 		{
    236 			input ivec3 in0		= [ ivec3(-1, 0, 2) | ivec3(1, 4, -8) ];
    237 			output int out0		= [ -1 | 3 ];
    238 		}
    239 
    240 		both ""
    241 			precision mediump float;
    242 			precision mediump int;
    243 			${DECLARATIONS}
    244 
    245 			int func (ivec3 a)
    246 			{
    247 				return -(a.x + a.y + a.z);
    248 			}
    249 
    250 			void main()
    251 			{
    252 				${SETUP}
    253 				out0 = func(in0);
    254 				${OUTPUT}
    255 			}
    256 		""
    257 	end
    258 
    259 	case int_ivec4
    260 		values
    261 		{
    262 			input ivec4 in0		= [ ivec4(-1, 0, 2, 2) | ivec4(1, 4, -8, 2) ];
    263 			output int out0		= [ -3 | 1 ];
    264 		}
    265 
    266 		both ""
    267 			precision mediump float;
    268 			precision mediump int;
    269 			${DECLARATIONS}
    270 
    271 			int func (ivec4 a)
    272 			{
    273 				return -(a.x + a.y + a.z + a.w);
    274 			}
    275 
    276 			void main()
    277 			{
    278 				${SETUP}
    279 				out0 = func(in0);
    280 				${OUTPUT}
    281 			}
    282 		""
    283 	end
    284 
    285 	case bool_bool
    286 		values
    287 		{
    288 			input bool in0		= [ true | false ];
    289 			output bool out0	= [ false | true ];
    290 		}
    291 
    292 		both ""
    293 			precision mediump float;
    294 			${DECLARATIONS}
    295 
    296 			bool func (bool a)
    297 			{
    298 				return !a;
    299 			}
    300 
    301 			void main()
    302 			{
    303 				${SETUP}
    304 				out0 = func(in0);
    305 				${OUTPUT}
    306 			}
    307 		""
    308 	end
    309 
    310 	case bool_bvec2
    311 		values
    312 		{
    313 			input bvec2 in0		= [ bvec2(true, true) | bvec2(false, true) ];
    314 			output bool out0	= [ false | true ];
    315 		}
    316 
    317 		both ""
    318 			precision mediump float;
    319 			${DECLARATIONS}
    320 
    321 			bool func (bvec2 a)
    322 			{
    323 				return !(a.x == a.y);
    324 			}
    325 
    326 			void main()
    327 			{
    328 				${SETUP}
    329 				out0 = func(in0);
    330 				${OUTPUT}
    331 			}
    332 		""
    333 	end
    334 
    335 	case bool_bvec3
    336 		values
    337 		{
    338 			input bvec3 in0		= [ bvec3(true, true, false) | bvec3(true, false, false) ];
    339 			output bool out0	= [ false | true ];
    340 		}
    341 
    342 		both ""
    343 			precision mediump float;
    344 			${DECLARATIONS}
    345 
    346 			bool func (bvec3 a)
    347 			{
    348 				return (a.x == a.y) == a.z;
    349 			}
    350 
    351 			void main()
    352 			{
    353 				${SETUP}
    354 				out0 = func(in0);
    355 				${OUTPUT}
    356 			}
    357 		""
    358 	end
    359 
    360 	case bool_bvec4
    361 		values
    362 		{
    363 			input bvec4 in0		= [ bvec4(true, true, true, false) | bvec4(false, false, true, true) | bvec4(true, false, false, true) ];
    364 			output bool out0	= [ false | true | true ];
    365 		}
    366 
    367 		both ""
    368 			precision mediump float;
    369 			${DECLARATIONS}
    370 
    371 			bool func (bvec4 a)
    372 			{
    373 				return ((a.x == a.y) == (a.z == a.w));
    374 			}
    375 
    376 			void main()
    377 			{
    378 				${SETUP}
    379 				out0 = func(in0);
    380 				${OUTPUT}
    381 			}
    382 		""
    383 	end
    384 
    385 	case mat2
    386 		values
    387 		{
    388 			input mat2 in0	= [ mat2(-2.0, 0.5, -1.0, 1.0) | mat2(1.0, -3.5, -3.5, 2.5) | mat2(-2.0, -2.0, 3.5, 0.0) ];
    389 			output mat2 out0	= [ mat2(4.0, -1.0, 2.0, -2.0) | mat2(-2.0, 7.0, 7.0, -5.0) | mat2(4.0, 4.0, -7.0, -0.0) ];
    390 		}
    391 
    392 		both ""
    393 			precision mediump float;
    394 			${DECLARATIONS}
    395 
    396 			mat2 func (mat2 a)
    397 			{
    398 				return -2.0*a;
    399 			}
    400 
    401 			void main()
    402 			{
    403 				${SETUP}
    404 				out0 = func(in0);
    405 				${OUTPUT}
    406 			}
    407 		""
    408 	end
    409 
    410 
    411 	case mat3
    412 		values
    413 		{
    414 			input mat3 in0	= [ mat3(2.5, 0.0, 1.0, -2.5, 1.0, 3.0, 0.0, 2.0, 1.5) | mat3(-3.5, 2.0, 0.5, -1.5, -3.5, 2.5, 0.0, 1.5, 3.0) | mat3(1.5, 3.0, -1.0, 2.5, -0.5, 3.5, 3.0, -3.0, -2.5) ];
    415 			output mat3 out0	= [ mat3(-5.0, -0.0, -2.0, 5.0, -2.0, -6.0, -0.0, -4.0, -3.0) | mat3(7.0, -4.0, -1.0, 3.0, 7.0, -5.0, -0.0, -3.0, -6.0) | mat3(-3.0, -6.0, 2.0, -5.0, 1.0, -7.0, -6.0, 6.0, 5.0) ];
    416 		}
    417 
    418 		both ""
    419 			precision mediump float;
    420 			${DECLARATIONS}
    421 
    422 			mat3 func (mat3 a)
    423 			{
    424 				return -2.0*a;
    425 			}
    426 
    427 			void main()
    428 			{
    429 				${SETUP}
    430 				out0 = func(in0);
    431 				${OUTPUT}
    432 			}
    433 		""
    434 	end
    435 
    436 
    437 	case mat4
    438 		values
    439 		{
    440 			input mat4 in0	= [ mat4(-2.0, 3.5, -0.5, 1.0, -1.5, 0.0, -1.0, -1.0, 0.5, 0.5, 3.0, 1.5, 3.0, 2.5, 3.5, 1.5) | mat4(-2.5, 2.5, 3.5, 3.0, 0.5, 1.5, -2.0, 2.5, 0.5, -1.5, -3.5, 2.5, 3.5, -3.0, 2.5, -0.5) | mat4(-2.5, -1.5, 2.0, 3.0, -3.5, 1.0, -3.5, 1.5, -1.5, 3.0, 3.5, 0.0, 3.5, -1.5, -3.0, 0.5) ];
    441 			output mat4 out0	= [ mat4(4.0, -7.0, 1.0, -2.0, 3.0, -0.0, 2.0, 2.0, -1.0, -1.0, -6.0, -3.0, -6.0, -5.0, -7.0, -3.0) | mat4(5.0, -5.0, -7.0, -6.0, -1.0, -3.0, 4.0, -5.0, -1.0, 3.0, 7.0, -5.0, -7.0, 6.0, -5.0, 1.0) | mat4(5.0, 3.0, -4.0, -6.0, 7.0, -2.0, 7.0, -3.0, 3.0, -6.0, -7.0, -0.0, -7.0, 3.0, 6.0, -1.0) ];
    442 		}
    443 
    444 		both ""
    445 			precision mediump float;
    446 			${DECLARATIONS}
    447 
    448 			mat4 func (mat4 a)
    449 			{
    450 				return -2.0*a;
    451 			}
    452 
    453 			void main()
    454 			{
    455 				${SETUP}
    456 				out0 = func(in0);
    457 				${OUTPUT}
    458 			}
    459 		""
    460 	end
    461 
    462 	case float_struct
    463 		values
    464 		{
    465 			input vec3 in0		= [ vec3(0.0, 1.0, -2.0) | vec3(2.0, 2.5, -4.0) ];
    466 			output float out0	= [ 1.0 | -0.5 ];
    467 		}
    468 
    469 		both ""
    470 			precision mediump float;
    471 			${DECLARATIONS}
    472 
    473 			struct Pos { float a, b, c; };
    474 
    475 			float func (Pos p)
    476 			{
    477 				return -(p.a + p.b + p.c);
    478 			}
    479 
    480 			void main()
    481 			{
    482 				Pos p = Pos(in0.x, in0.y, in0.z);
    483 				out0 = func(p);
    484 				${OUTPUT}
    485 			}
    486 		""
    487 	end
    488 
    489 	case struct_struct
    490 		values
    491 		{
    492 			input vec3 in0		= [ vec3(0.0, 1.0, -2.0) | vec3(2.0, 2.5, -4.0) ];
    493 			output float out0	= [ 1.0 | -0.5 ];
    494 		}
    495 
    496 		both ""
    497 			precision mediump float;
    498 			${DECLARATIONS}
    499 
    500 			struct Pos { float a, b, c; };
    501 
    502 			Pos func (Pos p)
    503 			{
    504 				return Pos(-p.a, -p.b, -p.c);
    505 			}
    506 
    507 			void main()
    508 			{
    509 				Pos p = Pos(in0.x, in0.y, in0.z);
    510 				p = func(p);
    511 				out0 = p.a + p.b + p.c;
    512 				${OUTPUT}
    513 			}
    514 		""
    515 	end
    516 
    517 	case struct_nested_struct
    518 		values
    519 		{
    520 			input vec3 in0		= [ vec3(0.0, 1.0, -2.0) | vec3(2.0, 2.5, -4.0) ];
    521 			output float out0	= [ 1.0 | -0.5 ];
    522 		}
    523 
    524 		both ""
    525 			precision mediump float;
    526 			${DECLARATIONS}
    527 
    528 			struct Pos { float a, b, c; };
    529 			struct Line { Pos start, end; };
    530 
    531 			Line func (Pos p)
    532 			{
    533 				return Line(p, Pos(-p.a, -p.b, -p.c));
    534 			}
    535 
    536 			float sum (Pos p)
    537 			{
    538 				return (p.a + p.b + p.c);
    539 			}
    540 
    541 			void main()
    542 			{
    543 				Pos p = Pos(in0.x, in0.y, in0.z);
    544 				Line line = func(p);
    545 				out0 = sum(line.start) + (2.0 * sum(line.end));
    546 				${OUTPUT}
    547 			}
    548 		""
    549 	end
    550 
    551 
    552 end # datatypes
    553 
    554 group qualifiers "Function Parameter Qualifiers"
    555 
    556 	case in_float
    557 		values
    558 		{
    559 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    560 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    561 		}
    562 
    563 		both ""
    564 			precision mediump float;
    565 			precision mediump int;
    566 			${DECLARATIONS}
    567 
    568 			float func (in float a)
    569 			{
    570 				a = -a;
    571 				return 2.0 * a;
    572 			}
    573 
    574 			void main()
    575 			{
    576 				${SETUP}
    577 				float f = in0;
    578 				float g = func(f);
    579 				out0 = f + g;
    580 				${OUTPUT}
    581 			}
    582 		""
    583 	end
    584 
    585 	case out_float
    586 		values
    587 		{
    588 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    589 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    590 		}
    591 
    592 		both ""
    593 			precision mediump float;
    594 			precision mediump int;
    595 			${DECLARATIONS}
    596 
    597 			void func (out float a)
    598 			{
    599 				a = -1.0;
    600 			}
    601 
    602 			void main()
    603 			{
    604 				${SETUP}
    605 				float f = 1.0;
    606 				func(f);
    607 				out0 = f * in0;
    608 				${OUTPUT}
    609 			}
    610 		""
    611 	end
    612 
    613 	case inout_float
    614 		values
    615 		{
    616 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    617 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    618 		}
    619 
    620 		both ""
    621 			precision mediump float;
    622 			precision mediump int;
    623 			${DECLARATIONS}
    624 
    625 			void func (inout float a)
    626 			{
    627 				a = -a;
    628 			}
    629 
    630 			void main()
    631 			{
    632 				${SETUP}
    633 				float f = 1.0;
    634 				func(f);
    635 				out0 = f * in0;
    636 				${OUTPUT}
    637 			}
    638 		""
    639 	end
    640 
    641 	case in_lowp_float
    642 		values
    643 		{
    644 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    645 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    646 		}
    647 
    648 		both ""
    649 			precision mediump float;
    650 			precision mediump int;
    651 			${DECLARATIONS}
    652 
    653 			float func (in lowp float a)
    654 			{
    655 				a = -a;
    656 				return 2.0 * a;
    657 			}
    658 
    659 			void main()
    660 			{
    661 				${SETUP}
    662 				float f = in0;
    663 				float g = func(f);
    664 				out0 = f + g;
    665 				${OUTPUT}
    666 			}
    667 		""
    668 	end
    669 
    670 	case out_lowp_float
    671 		values
    672 		{
    673 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    674 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    675 		}
    676 
    677 		both ""
    678 			precision mediump float;
    679 			precision mediump int;
    680 			${DECLARATIONS}
    681 
    682 			void func (out lowp float a)
    683 			{
    684 				a = -1.0;
    685 			}
    686 
    687 			void main()
    688 			{
    689 				${SETUP}
    690 				float f = 1.0;
    691 				func(f);
    692 				out0 = f * in0;
    693 				${OUTPUT}
    694 			}
    695 		""
    696 	end
    697 
    698 	case inout_lowp_float
    699 		values
    700 		{
    701 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    702 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    703 		}
    704 
    705 		both ""
    706 			precision mediump float;
    707 			precision mediump int;
    708 			${DECLARATIONS}
    709 
    710 			void func (inout lowp float a)
    711 			{
    712 				a = -a;
    713 			}
    714 
    715 			void main()
    716 			{
    717 				${SETUP}
    718 				float f = 1.0;
    719 				func(f);
    720 				out0 = f * in0;
    721 				${OUTPUT}
    722 			}
    723 		""
    724 	end
    725 
    726 	case in_highp_float
    727 		values
    728 		{
    729 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    730 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    731 		}
    732 
    733 		both ""
    734 			precision mediump float;
    735 			precision mediump int;
    736 			${DECLARATIONS}
    737 
    738 			float func (in highp float a)
    739 			{
    740 				a = -a;
    741 				return 2.0 * a;
    742 			}
    743 
    744 			void main()
    745 			{
    746 				${SETUP}
    747 				float f = in0;
    748 				float g = func(f);
    749 				out0 = f + g;
    750 				${OUTPUT}
    751 			}
    752 		""
    753 	end
    754 
    755 	case out_highp_float
    756 		values
    757 		{
    758 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    759 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    760 		}
    761 
    762 		both ""
    763 			precision mediump float;
    764 			precision mediump int;
    765 			${DECLARATIONS}
    766 
    767 			void func (out highp float a)
    768 			{
    769 				a = -1.0;
    770 			}
    771 
    772 			void main()
    773 			{
    774 				${SETUP}
    775 				float f = 1.0;
    776 				func(f);
    777 				out0 = f * in0;
    778 				${OUTPUT}
    779 			}
    780 		""
    781 	end
    782 
    783 	case inout_highp_float
    784 		values
    785 		{
    786 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    787 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    788 		}
    789 
    790 		both ""
    791 			precision mediump float;
    792 			precision mediump int;
    793 			${DECLARATIONS}
    794 
    795 			void func (inout highp float a)
    796 			{
    797 				a = -a;
    798 			}
    799 
    800 			void main()
    801 			{
    802 				${SETUP}
    803 				float f = 1.0;
    804 				func(f);
    805 				out0 = f * in0;
    806 				${OUTPUT}
    807 			}
    808 		""
    809 	end
    810 
    811 	case const_float
    812 		values
    813 		{
    814 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    815 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    816 		}
    817 
    818 		both ""
    819 			precision mediump float;
    820 			precision mediump int;
    821 			${DECLARATIONS}
    822 
    823 			float func (const float a)
    824 			{
    825 				float b = -a;
    826 				return 2.0 * b;
    827 			}
    828 
    829 			void main()
    830 			{
    831 				${SETUP}
    832 				float f = in0;
    833 				float g = func(f);
    834 				out0 = f + g;
    835 				${OUTPUT}
    836 			}
    837 		""
    838 	end
    839 
    840 	case const_in_float
    841 		values
    842 		{
    843 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
    844 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
    845 		}
    846 
    847 		both ""
    848 			precision mediump float;
    849 			precision mediump int;
    850 			${DECLARATIONS}
    851 
    852 			float func (const in float a)
    853 			{
    854 				float b = -a;
    855 				return 2.0 * b;
    856 			}
    857 
    858 			void main()
    859 			{
    860 				${SETUP}
    861 				float f = in0;
    862 				float g = func(f);
    863 				out0 = f + g;
    864 				${OUTPUT}
    865 			}
    866 		""
    867 	end
    868 
    869 	case in_int
    870 		values
    871 		{
    872 			input int in0		= [ 0 | 1 | -2 | 4 ];
    873 			output int out0		= [ 0 | -1 | 2 | -4 ];
    874 		}
    875 
    876 		both ""
    877 			precision mediump float;
    878 			precision mediump int;
    879 			${DECLARATIONS}
    880 
    881 			int func (in int a)
    882 			{
    883 				a = -a;
    884 				return 2 * a;
    885 			}
    886 
    887 			void main()
    888 			{
    889 				${SETUP}
    890 				int f = in0;
    891 				int g = func(f);
    892 				out0 = f + g;
    893 				${OUTPUT}
    894 			}
    895 		""
    896 	end
    897 
    898 	case out_int
    899 		values
    900 		{
    901 			input int in0		= [ 0 | 1 | -2 | 6 ];
    902 			output int out0		= [ 0 | -1 | 2 | -6 ];
    903 		}
    904 
    905 		both ""
    906 			precision mediump float;
    907 			precision mediump int;
    908 			${DECLARATIONS}
    909 
    910 			void func (out int a)
    911 			{
    912 				a = -1;
    913 			}
    914 
    915 			void main()
    916 			{
    917 				${SETUP}
    918 				int f = 1;
    919 				func(f);
    920 				out0 = f * in0;
    921 				${OUTPUT}
    922 			}
    923 		""
    924 	end
    925 
    926 	case inout_int
    927 		values
    928 		{
    929 			input int in0		= [ 0 | 1 | -2 | 6 ];
    930 			output int out0		= [ 0 | -1 | 2 | -6 ];
    931 		}
    932 
    933 		both ""
    934 			precision mediump float;
    935 			precision mediump int;
    936 			${DECLARATIONS}
    937 
    938 			void func (inout int a)
    939 			{
    940 				a = -a;
    941 			}
    942 
    943 			void main()
    944 			{
    945 				${SETUP}
    946 				int f = 1;
    947 				func(f);
    948 				out0 = f * in0;
    949 				${OUTPUT}
    950 			}
    951 		""
    952 	end
    953 
    954 	case in_lowp_int
    955 		values
    956 		{
    957 			input int in0		= [ 0 | 1 | -2 | 4 ];
    958 			output int out0		= [ 0 | -1 | 2 | -4 ];
    959 		}
    960 
    961 		both ""
    962 			precision mediump float;
    963 			precision mediump int;
    964 			${DECLARATIONS}
    965 
    966 			int func (in lowp int a)
    967 			{
    968 				a = -a;
    969 				return 2 * a;
    970 			}
    971 
    972 			void main()
    973 			{
    974 				${SETUP}
    975 				int f = in0;
    976 				int g = func(f);
    977 				out0 = f + g;
    978 				${OUTPUT}
    979 			}
    980 		""
    981 	end
    982 
    983 	case out_lowp_int
    984 		values
    985 		{
    986 			input int in0		= [ 0 | 1 | -2 | 6 ];
    987 			output int out0		= [ 0 | -1 | 2 | -6 ];
    988 		}
    989 
    990 		both ""
    991 			precision mediump float;
    992 			precision mediump int;
    993 			${DECLARATIONS}
    994 
    995 			void func (out lowp int a)
    996 			{
    997 				a = -1;
    998 			}
    999 
   1000 			void main()
   1001 			{
   1002 				${SETUP}
   1003 				int f = 1;
   1004 				func(f);
   1005 				out0 = f * in0;
   1006 				${OUTPUT}
   1007 			}
   1008 		""
   1009 	end
   1010 
   1011 	case inout_lowp_int
   1012 		values
   1013 		{
   1014 			input int in0		= [ 0 | 1 | -2 | 6 ];
   1015 			output int out0		= [ 0 | -1 | 2 | -6 ];
   1016 		}
   1017 
   1018 		both ""
   1019 			precision mediump float;
   1020 			precision mediump int;
   1021 			${DECLARATIONS}
   1022 
   1023 			void func (inout lowp int a)
   1024 			{
   1025 				a = -a;
   1026 			}
   1027 
   1028 			void main()
   1029 			{
   1030 				${SETUP}
   1031 				int f = 1;
   1032 				func(f);
   1033 				out0 = f * in0;
   1034 				${OUTPUT}
   1035 			}
   1036 		""
   1037 	end
   1038 
   1039 	case in_highp_int
   1040 		values
   1041 		{
   1042 			input int in0		= [ 0 | 1 | -2 | 4 ];
   1043 			output int out0		= [ 0 | -1 | 2 | -4 ];
   1044 		}
   1045 
   1046 		both ""
   1047 			precision mediump float;
   1048 			precision mediump int;
   1049 			${DECLARATIONS}
   1050 
   1051 			int func (in highp int a)
   1052 			{
   1053 				a = -a;
   1054 				return 2 * a;
   1055 			}
   1056 
   1057 			void main()
   1058 			{
   1059 				${SETUP}
   1060 				int f = in0;
   1061 				int g = func(f);
   1062 				out0 = f + g;
   1063 				${OUTPUT}
   1064 			}
   1065 		""
   1066 	end
   1067 
   1068 	case out_highp_int
   1069 		values
   1070 		{
   1071 			input int in0		= [ 0 | 1 | -2 | 6 ];
   1072 			output int out0		= [ 0 | -1 | 2 | -6 ];
   1073 		}
   1074 
   1075 		both ""
   1076 			precision mediump float;
   1077 			precision mediump int;
   1078 			${DECLARATIONS}
   1079 
   1080 			void func (out highp int a)
   1081 			{
   1082 				a = -1;
   1083 			}
   1084 
   1085 			void main()
   1086 			{
   1087 				${SETUP}
   1088 				int f = 1;
   1089 				func(f);
   1090 				out0 = f * in0;
   1091 				${OUTPUT}
   1092 			}
   1093 		""
   1094 	end
   1095 
   1096 	case inout_highp_int
   1097 		values
   1098 		{
   1099 			input int in0		= [ 0 | 1 | -2 | 6 ];
   1100 			output int out0		= [ 0 | -1 | 2 | -6 ];
   1101 		}
   1102 
   1103 		both ""
   1104 			precision mediump float;
   1105 			precision mediump int;
   1106 			${DECLARATIONS}
   1107 
   1108 			void func (inout highp int a)
   1109 			{
   1110 				a = -a;
   1111 			}
   1112 
   1113 			void main()
   1114 			{
   1115 				${SETUP}
   1116 				int f = 1;
   1117 				func(f);
   1118 				out0 = f * in0;
   1119 				${OUTPUT}
   1120 			}
   1121 		""
   1122 	end
   1123 
   1124 	case const_int
   1125 		values
   1126 		{
   1127 			input int in0		= [ 0 | 1 | -2 | 4 ];
   1128 			output int out0		= [ 0 | -1 | 2 | -4 ];
   1129 		}
   1130 
   1131 		both ""
   1132 			precision mediump float;
   1133 			precision mediump int;
   1134 			${DECLARATIONS}
   1135 
   1136 			int func (const int a)
   1137 			{
   1138 				int b = -a;
   1139 				return 2 * b;
   1140 			}
   1141 
   1142 			void main()
   1143 			{
   1144 				${SETUP}
   1145 				int f = in0;
   1146 				int g = func(f);
   1147 				out0 = f + g;
   1148 				${OUTPUT}
   1149 			}
   1150 		""
   1151 	end
   1152 
   1153 	case const_in_int
   1154 		values
   1155 		{
   1156 			input int in0		= [ 0 | 1 | -2 | 4 ];
   1157 			output int out0		= [ 0 | -1 | 2 | -4 ];
   1158 		}
   1159 
   1160 		both ""
   1161 			precision mediump float;
   1162 			precision mediump int;
   1163 			${DECLARATIONS}
   1164 
   1165 			int func (const in int a)
   1166 			{
   1167 				int b = -a;
   1168 				return 2 * b;
   1169 			}
   1170 
   1171 			void main()
   1172 			{
   1173 				${SETUP}
   1174 				int f = in0;
   1175 				int g = func(f);
   1176 				out0 = f + g;
   1177 				${OUTPUT}
   1178 			}
   1179 		""
   1180 	end
   1181 
   1182 	case in_bool
   1183 		values
   1184 		{
   1185 			input bool in0		= [ true | false ];
   1186 			output bool out0	= [ true | true ];
   1187 		}
   1188 
   1189 		both ""
   1190 			precision mediump float;
   1191 			${DECLARATIONS}
   1192 
   1193 			bool func (in bool a)
   1194 			{
   1195 				a = !a;
   1196 				return a;
   1197 			}
   1198 
   1199 			void main()
   1200 			{
   1201 				${SETUP}
   1202 				bool f = in0;
   1203 				bool g = func(f);
   1204 				out0 = (f != g);
   1205 				${OUTPUT}
   1206 			}
   1207 		""
   1208 	end
   1209 
   1210 	case out_bool
   1211 		values
   1212 		{
   1213 			input bool in0		= [ true | false ];
   1214 			output bool out0	= [ false | true ];
   1215 		}
   1216 
   1217 		both ""
   1218 			precision mediump float;
   1219 			${DECLARATIONS}
   1220 
   1221 			void func (out bool a)
   1222 			{
   1223 				a = false;
   1224 			}
   1225 
   1226 			void main()
   1227 			{
   1228 				${SETUP}
   1229 				bool f = true;
   1230 				func(f);
   1231 				out0 = (in0 == f);
   1232 				${OUTPUT}
   1233 			}
   1234 		""
   1235 	end
   1236 
   1237 	case inout_bool
   1238 		values
   1239 		{
   1240 			input bool in0		= [ true | false ];
   1241 			output bool out0	= [ false | true ];
   1242 		}
   1243 
   1244 		both ""
   1245 			precision mediump float;
   1246 			${DECLARATIONS}
   1247 
   1248 			void func (inout bool a)
   1249 			{
   1250 				a = !a;
   1251 			}
   1252 
   1253 			void main()
   1254 			{
   1255 				${SETUP}
   1256 				bool f = true;
   1257 				func(f);
   1258 				out0 = (in0 == f);
   1259 				${OUTPUT}
   1260 			}
   1261 		""
   1262 	end
   1263 
   1264 end # qualifiers
   1265 
   1266 group declarations "Function Declarations"
   1267 
   1268 	case void_vs_no_void
   1269 		values
   1270 		{
   1271 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1272 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1273 		}
   1274 
   1275 		both ""
   1276 			precision mediump float;
   1277 			${DECLARATIONS}
   1278 
   1279 			float func ();
   1280 
   1281 			void main()
   1282 			{
   1283 				out0 = func() * in0;
   1284 				${OUTPUT}
   1285 			}
   1286 
   1287 			float func (void)
   1288 			{
   1289 				return -1.0;
   1290 			}
   1291 		""
   1292 	end
   1293 
   1294 	case in_vs_no_in
   1295 		values
   1296 		{
   1297 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1298 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1299 		}
   1300 
   1301 		both ""
   1302 			precision mediump float;
   1303 			${DECLARATIONS}
   1304 
   1305 			float func (float f);
   1306 
   1307 			void main()
   1308 			{
   1309 				out0 = func(in0);
   1310 				${OUTPUT}
   1311 			}
   1312 
   1313 			float func (in float f)
   1314 			{
   1315 				return -f;
   1316 			}
   1317 		""
   1318 	end
   1319 
   1320 	case default_vs_explicit_precision
   1321 		values
   1322 		{
   1323 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1324 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1325 		}
   1326 
   1327 		both ""
   1328 			precision mediump float;
   1329 			${DECLARATIONS}
   1330 
   1331 			float func (float f);
   1332 
   1333 			void main()
   1334 			{
   1335 				out0 = func(in0);
   1336 				${OUTPUT}
   1337 			}
   1338 
   1339 			float func (mediump float f)
   1340 			{
   1341 				return -f;
   1342 			}
   1343 		""
   1344 	end
   1345 
   1346 end # declarations
   1347 
   1348 group overloading "Function Overloading"
   1349 
   1350 	case user_func_arg_type_simple
   1351 		values
   1352 		{
   1353 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1354 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1355 		}
   1356 
   1357 		both ""
   1358 			precision mediump float;
   1359 			precision mediump int;
   1360 			${DECLARATIONS}
   1361 
   1362 			float func (float a)
   1363 			{
   1364 				return -a;
   1365 			}
   1366 
   1367 			int func (int a)
   1368 			{
   1369 				return -a;
   1370 			}
   1371 
   1372 			void main()
   1373 			{
   1374 				out0 = func(in0) * float(func(-1));
   1375 				${OUTPUT}
   1376 			}
   1377 		""
   1378 	end
   1379 
   1380 	case user_func_arg_float_types
   1381 		values
   1382 		{
   1383 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1384 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1385 		}
   1386 
   1387 		both ""
   1388 			precision mediump float;
   1389 			precision mediump int;
   1390 			${DECLARATIONS}
   1391 
   1392 			float func (float a) { return -a; }
   1393 			vec2 func (vec2 a) { return a.yx; }
   1394 			vec3 func (vec3 a) { return a.xxx; }
   1395 			vec4 func (vec4 a) { return a.wwww; }
   1396 
   1397 			void main()
   1398 			{
   1399 				out0 = func(func(func(func(vec4(in0)).xyz).xy).x);
   1400 				${OUTPUT}
   1401 			}
   1402 		""
   1403 	end
   1404 
   1405 	case user_func_arg_int_types
   1406 		values
   1407 		{
   1408 			input int in0		= [ 0 | 1 | -2 | 6 ];
   1409 			output int out0		= [ 0 | -1 | 2 | -6 ];
   1410 		}
   1411 
   1412 		both ""
   1413 			precision mediump float;
   1414 			precision mediump int;
   1415 			${DECLARATIONS}
   1416 
   1417 			int func (int a) { return -a; }
   1418 			ivec2 func (ivec2 a) { return a.yx; }
   1419 			ivec3 func (ivec3 a) { return a.xxx; }
   1420 			ivec4 func (ivec4 a) { return a.wwww; }
   1421 
   1422 			void main()
   1423 			{
   1424 				${SETUP}
   1425 				out0 = func(func(func(func(ivec4(in0)).xyz).xy).x);
   1426 				${OUTPUT}
   1427 			}
   1428 		""
   1429 	end
   1430 
   1431 	case user_func_arg_bool_types
   1432 		values
   1433 		{
   1434 			input bool in0		= [ true | false ];
   1435 			output bool out0	= [ false | true ];
   1436 		}
   1437 
   1438 		both ""
   1439 			precision mediump float;
   1440 			${DECLARATIONS}
   1441 
   1442 			bool func (bool a) { return !a; }
   1443 			bvec2 func (bvec2 a) { return a.yx; }
   1444 			bvec3 func (bvec3 a) { return a.xxx; }
   1445 			bvec4 func (bvec4 a) { return a.wwww; }
   1446 
   1447 			void main()
   1448 			{
   1449 				${SETUP}
   1450 				out0 = func(func(func(func(bvec4(in0)).xyz).xy).x);
   1451 				${OUTPUT}
   1452 			}
   1453 		""
   1454 	end
   1455 
   1456 	case user_func_arg_basic_types
   1457 		values
   1458 		{
   1459 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1460 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1461 		}
   1462 
   1463 		both ""
   1464 			precision mediump float;
   1465 			precision mediump int;
   1466 			${DECLARATIONS}
   1467 
   1468 			float func (float a) { return -a; }
   1469 			vec2 func (vec2 a) { return a.yx; }
   1470 			vec3 func (vec3 a) { return a.xxx; }
   1471 			vec4 func (vec4 a) { return a.wwww; }
   1472 			int func (int a) { return -a; }
   1473 			ivec2 func (ivec2 a) { return a.yx; }
   1474 			ivec3 func (ivec3 a) { return a.xxx; }
   1475 			ivec4 func (ivec4 a) { return a.wwww; }
   1476 			bool func (bool a) { return !a; }
   1477 			bvec2 func (bvec2 a) { return a.yx; }
   1478 			bvec3 func (bvec3 a) { return a.xxx; }
   1479 			bvec4 func (bvec4 a) { return a.wwww; }
   1480 
   1481 			void main()
   1482 			{
   1483 				${SETUP}
   1484 				if (func(func(bvec4(false)).x))
   1485 					out0 = func(in0) * float(func(-1));
   1486 				else
   1487 					out0 = float(func(func(ivec4(func(func(func(vec4(0.5)).xyz).xy).xxxx)).xy).x);
   1488 				${OUTPUT}
   1489 			}
   1490 		""
   1491 	end
   1492 
   1493 	case user_func_arg_complex_types
   1494 		values
   1495 		{
   1496 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1497 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1498 		}
   1499 
   1500 		both ""
   1501 			precision mediump float;
   1502 			precision mediump int;
   1503 			${DECLARATIONS}
   1504 
   1505 			struct Pos { float a, b, c; };
   1506 			struct Line { Pos start, end; };
   1507 
   1508 			float func (float a) { return -a; }
   1509 			float func (float a[4]) { return a[0] + a[3]; }
   1510 			vec2 func (vec2 a) { return a.yx; }
   1511 			vec3 func (vec3 a) { return a.xxx; }
   1512 			vec4 func (vec4 a) { return a.wwww; }
   1513 			vec4 func (vec4 a[4]) { return a[1] + a[2]; }
   1514 			int func (int a) { return -a; }
   1515 			ivec2 func (ivec2 a) { return a.yx; }
   1516 			ivec3 func (ivec3 a) { return a.xxx; }
   1517 			ivec4 func (ivec4 a) { return a.wwww; }
   1518 			bool func (bool a) { return !a; }
   1519 			bvec2 func (bvec2 a) { return a.yx; }
   1520 			bvec3 func (bvec3 a) { return a.xxx; }
   1521 			bvec4 func (bvec4 a) { return a.wwww; }
   1522 			Pos func (Pos a) { return a; }
   1523 			Line func (Line a) { return Line(a.end, a.start); }
   1524 
   1525 			void main()
   1526 			{
   1527 				${SETUP}
   1528 				float arr[4];
   1529 				vec4 arr2[4];
   1530 				out0 = func(arr) + func(arr2).x;
   1531 				if (func(func(bvec4(false)).x))
   1532 					out0 = func(in0) * float(func(-1));
   1533 				else
   1534 					out0 = float(func(func(ivec4(func(func(func(vec4(0.5)).xyz).xy).xxxx)).xy).x);
   1535 				${OUTPUT}
   1536 			}
   1537 		""
   1538 	end
   1539 
   1540 	case user_func_arguments
   1541 		values
   1542 		{
   1543 			input float in0		= [ 0.0 | 1.0 | -2.0 | 2.5 ];
   1544 			output float out0	= [ 0.0 | -1.0 | 2.0 | -2.5 ];
   1545 		}
   1546 
   1547 		both ""
   1548 			precision mediump float;
   1549 			${DECLARATIONS}
   1550 
   1551 			float func (float a)
   1552 			{
   1553 				return -a;
   1554 			}
   1555 
   1556 			float func (float a, float b)
   1557 			{
   1558 				return a * b;
   1559 			}
   1560 
   1561 			void main()
   1562 			{
   1563 				out0 = func(in0) * func(-0.5, -2.0);
   1564 				${OUTPUT}
   1565 			}
   1566 		""
   1567 	end
   1568 
   1569 	case builtin_sin
   1570 		values
   1571 		{
   1572 			input int in0		= [ -1 | 0 | 1 | 4 ];
   1573 			output int out0		= [ 1 | 0 | -1 | -4 ];
   1574 		}
   1575 
   1576 		both ""
   1577 			precision mediump float;
   1578 			precision mediump int;
   1579 			${DECLARATIONS}
   1580 
   1581 			int sin(int a) { return -a; }
   1582 
   1583 			void main()
   1584 			{
   1585 				${SETUP}
   1586 				out0 = sin(in0);
   1587 				${OUTPUT}
   1588 			}
   1589 		""
   1590 	end
   1591 
   1592 	case builtin_step
   1593 		values
   1594 		{
   1595 			input int in0		= [ -1 | 0 | 1 | 4 ];
   1596 			output int out0		= [ 1 | 0 | -1 | -4 ];
   1597 		}
   1598 
   1599 		both ""
   1600 			precision mediump float;
   1601 			precision mediump int;
   1602 			${DECLARATIONS}
   1603 
   1604 			int step (float i, float j, int a) { return -a; }
   1605 
   1606 			void main()
   1607 			{
   1608 				${SETUP}
   1609 				out0 = step(0.0, 1.0, in0);
   1610 				${OUTPUT}
   1611 			}
   1612 		""
   1613 	end
   1614 
   1615 	case array_size
   1616 		values
   1617 		{
   1618 			output float out0	= [ 1.0 ];
   1619 		}
   1620 
   1621 		both ""
   1622 			precision mediump float;
   1623 			${DECLARATIONS}
   1624 
   1625 			float func (float f[3])
   1626 			{
   1627 				return f[0];
   1628 			}
   1629 
   1630 			float func (float f[4])
   1631 			{
   1632 				return f[1];
   1633 			}
   1634 
   1635 			void main ()
   1636 			{
   1637 				${SETUP}
   1638 				float x[4];
   1639 				x[0] = -1.0;
   1640 				x[1] = 1.0;
   1641 				x[2] = x[3] = 0.0;
   1642 				out0 = func(x);
   1643 				${OUTPUT}
   1644 			}
   1645 		""
   1646 	end
   1647 
   1648 end # overloading
   1649 
   1650 group array_arguments "Arrays as Arguments"
   1651 
   1652 	case local_in_float
   1653 		values
   1654 		{
   1655 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   1656 			output vec4 out0	= [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
   1657 		}
   1658 
   1659 		both ""
   1660 			precision mediump float;
   1661 			${DECLARATIONS}
   1662 
   1663 			float func (in float a[4])
   1664 			{
   1665 				a[0] = -1.0;
   1666 				a[2] = -4.0;
   1667 				a[3] = -3.0 * a[1];
   1668 				return a[0];
   1669 			}
   1670 
   1671 			void main()
   1672 			{
   1673 				float arr[4];
   1674 				arr[0] = in0.x;
   1675 				arr[1] = in0.y;
   1676 				arr[2] = in0.z;
   1677 				arr[3] = in0.w;
   1678 				float f = func(arr);
   1679 				out0 = f * vec4(arr[0], arr[1], arr[2], arr[3]);
   1680 				${OUTPUT}
   1681 			}
   1682 		""
   1683 	end
   1684 
   1685 	case global_in_float
   1686 		values
   1687 		{
   1688 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   1689 			output vec4 out0	= [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
   1690 		}
   1691 
   1692 		both ""
   1693 			precision mediump float;
   1694 			${DECLARATIONS}
   1695 
   1696 			float func (in float a[4])
   1697 			{
   1698 				a[0] = -1.0;
   1699 				a[2] = -4.0;
   1700 				a[3] = -3.0 * a[1];
   1701 				return a[0];
   1702 			}
   1703 
   1704 			float arr[4];
   1705 
   1706 			void main()
   1707 			{
   1708 				arr[0] = in0.x;
   1709 				arr[1] = in0.y;
   1710 				arr[2] = in0.z;
   1711 				arr[3] = in0.w;
   1712 				float f = func(arr);
   1713 				out0 = f * vec4(arr[0], arr[1], arr[2], arr[3]);
   1714 				${OUTPUT}
   1715 			}
   1716 		""
   1717 	end
   1718 
   1719 	case local_in_int
   1720 		values
   1721 		{
   1722 			input ivec4 in0		= [ ivec4(0, 1, 2, -4) | ivec4(-7, -11, 13, 19) ];
   1723 			output ivec4 out0	= [ ivec4(0, -1, -2, 4) | ivec4(7, 11, -13, -19) ];
   1724 		}
   1725 
   1726 		both ""
   1727 			precision mediump float;
   1728 			precision mediump int;
   1729 			${DECLARATIONS}
   1730 
   1731 			int func (in int a[4])
   1732 			{
   1733 				a[0] = -1;
   1734 				a[2] = -4;
   1735 				a[3] = -3 * a[1];
   1736 				return a[0];
   1737 			}
   1738 
   1739 			void main()
   1740 			{
   1741 				${SETUP}
   1742 				int arr[4];
   1743 				arr[0] = in0.x;
   1744 				arr[1] = in0.y;
   1745 				arr[2] = in0.z;
   1746 				arr[3] = in0.w;
   1747 				int f = func(arr);
   1748 				out0 = f * ivec4(arr[0], arr[1], arr[2], arr[3]);
   1749 				${OUTPUT}
   1750 			}
   1751 		""
   1752 	end
   1753 
   1754 	case global_in_int
   1755 		values
   1756 		{
   1757 			input ivec4 in0		= [ ivec4(0, 1, 2, 4) | ivec4(-7, -11, 13, 19) ];
   1758 			output ivec4 out0	= [ ivec4(0, -1, -2, -4) | ivec4(7, 11, -13, -19) ];
   1759 		}
   1760 
   1761 		both ""
   1762 			precision mediump float;
   1763 			precision mediump int;
   1764 			${DECLARATIONS}
   1765 
   1766 			int func (in int a[4])
   1767 			{
   1768 				a[0] = -1;
   1769 				a[2] = -4;
   1770 				a[3] = -3 * a[1];
   1771 				return a[0];
   1772 			}
   1773 
   1774 			int arr[4];
   1775 
   1776 			void main()
   1777 			{
   1778 				${SETUP}
   1779 				arr[0] = in0.x;
   1780 				arr[1] = in0.y;
   1781 				arr[2] = in0.z;
   1782 				arr[3] = in0.w;
   1783 				int f = func(arr);
   1784 				out0 = f * ivec4(arr[0], arr[1], arr[2], arr[3]);
   1785 				${OUTPUT}
   1786 			}
   1787 
   1788 		""
   1789 	end
   1790 
   1791 	case local_in_bool
   1792 		values
   1793 		{
   1794 			input bvec4 in0		= [ bvec4(true, true, false, true) | bvec4(false, false, false, false) ];
   1795 			output bvec4 out0	= [ bvec4(false, false, true, false) | bvec4(true, true, true, true) ];
   1796 		}
   1797 
   1798 		both ""
   1799 			precision mediump float;
   1800 			${DECLARATIONS}
   1801 
   1802 			bool func (in bool a[4])
   1803 			{
   1804 				a[0] = false;
   1805 				a[2] = true;
   1806 				a[3] = !a[1];
   1807 				return a[0];
   1808 			}
   1809 
   1810 			void main()
   1811 			{
   1812 				${SETUP}
   1813 				bool arr[4];
   1814 				arr[0] = !in0.x;
   1815 				arr[1] = !in0.y;
   1816 				arr[2] = !in0.z;
   1817 				arr[3] = !in0.w;
   1818 				func(arr);
   1819 				out0 = bvec4(arr[0], arr[1], arr[2], arr[3]);
   1820 				${OUTPUT}
   1821 			}
   1822 		""
   1823 	end
   1824 
   1825 	case global_in_bool
   1826 		values
   1827 		{
   1828 			input bvec4 in0		= [ bvec4(true, true, false, true) | bvec4(false, false, false, false) ];
   1829 			output bvec4 out0	= [ bvec4(false, false, true, false) | bvec4(true, true, true, true) ];
   1830 		}
   1831 
   1832 		both ""
   1833 			precision mediump float;
   1834 			${DECLARATIONS}
   1835 
   1836 			bool func (in bool a[4])
   1837 			{
   1838 				a[0] = false;
   1839 				a[2] = true;
   1840 				a[3] = !a[1];
   1841 				return a[0];
   1842 			}
   1843 
   1844 			bool arr[4];
   1845 
   1846 			void main()
   1847 			{
   1848 				${SETUP}
   1849 				arr[0] = !in0.x;
   1850 				arr[1] = !in0.y;
   1851 				arr[2] = !in0.z;
   1852 				arr[3] = !in0.w;
   1853 				func(arr);
   1854 				out0 = bvec4(arr[0], arr[1], arr[2], arr[3]);
   1855 				${OUTPUT}
   1856 			}
   1857 		""
   1858 	end
   1859 
   1860 	case test_helpers
   1861 		desc "Check that helper functions are supported properly."
   1862 		values
   1863 		{
   1864 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   1865 			output float out0	= [ 1.0 | 1.0 ];
   1866 		}
   1867 
   1868 		both ""
   1869 			precision mediump float;
   1870 			${DECLARATIONS}
   1871 
   1872 			vec4 get (in float arr[4]);
   1873 			void set (out float arr[4], vec4 val);
   1874 			void negate (inout float arr[4]);
   1875 			bool test (in float arr[4], vec4 ref);
   1876 			bool isEqual (in float a[4], in float b[4]);
   1877 
   1878 			void main()
   1879 			{
   1880 				float arr[4];
   1881 				set(arr, in0);
   1882 				negate(arr);
   1883 				out0 = float(test(arr, -in0));
   1884 				${OUTPUT}
   1885 			}
   1886 
   1887 			float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
   1888 			vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
   1889 			void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
   1890 			void negate (inout float arr[4]) { set(arr, -get(arr)); }
   1891 			bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
   1892 			bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
   1893 		""
   1894 	end
   1895 
   1896 	case copy_local_in_on_call
   1897 		desc "Check that local 'in' arguments are copied on call and don't alias."
   1898 		values
   1899 		{
   1900 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   1901 			output vec4 out0	= [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
   1902 		}
   1903 
   1904 		both ""
   1905 			precision mediump float;
   1906 			${DECLARATIONS}
   1907 
   1908 			vec4 get (in float arr[4]);
   1909 			void set (out float arr[4], vec4 val);
   1910 			void negate (inout float arr[4]);
   1911 			bool test (in float arr[4], vec4 ref);
   1912 			bool isEqual (in float a[4], in float b[4]);
   1913 
   1914 			float func (in float a[4], in float b[4])
   1915 			{
   1916 				a[0] = 2.123;
   1917 				a[2] = -4.123;
   1918 				return isEqual(a, b) ? 1.0 : -1.0;
   1919 			}
   1920 
   1921 			void main()
   1922 			{
   1923 				float arr[4];
   1924 				set(arr, in0);
   1925 				out0 = in0 * func(arr, arr);
   1926 				${OUTPUT}
   1927 			}
   1928 
   1929 			float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
   1930 			vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
   1931 			void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
   1932 			void negate (inout float arr[4]) { set(arr, -get(arr)); }
   1933 			bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
   1934 			bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
   1935 		""
   1936 	end
   1937 
   1938 	case copy_global_in_on_call
   1939 		desc "Check that global 'in' arguments are copied on call and don't alias."
   1940 		values
   1941 		{
   1942 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   1943 			output vec4 out0	= [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
   1944 		}
   1945 
   1946 		both ""
   1947 			precision mediump float;
   1948 			${DECLARATIONS}
   1949 
   1950 			vec4 get (in float arr[4]);
   1951 			void set (out float arr[4], vec4 val);
   1952 			void negate (inout float arr[4]);
   1953 			bool test (in float arr[4], vec4 ref);
   1954 			bool isEqual (in float a[4], in float b[4]);
   1955 
   1956 			float func (in float a[4], in float b[4])
   1957 			{
   1958 				a[0] = 2.123;
   1959 				a[2] = -4.123;
   1960 				return isEqual(a, b) ? 1.0 : -1.0;
   1961 			}
   1962 
   1963 			float arr[4];
   1964 
   1965 			void main()
   1966 			{
   1967 				set(arr, in0);
   1968 				out0 = in0 * func(arr, arr);
   1969 				${OUTPUT}
   1970 			}
   1971 
   1972 			float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
   1973 			vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
   1974 			void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
   1975 			void negate (inout float arr[4]) { set(arr, -get(arr)); }
   1976 			bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
   1977 			bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
   1978 		""
   1979 	end
   1980 
   1981 	case copy_local_inout_on_call
   1982 		desc "Check that local 'in' arguments are copied on call and don't alias."
   1983 		values
   1984 		{
   1985 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   1986 			output vec4 out0	= [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
   1987 		}
   1988 
   1989 		both ""
   1990 			precision mediump float;
   1991 			${DECLARATIONS}
   1992 
   1993 			vec4 get (in float arr[4]);
   1994 			void set (out float arr[4], vec4 val);
   1995 			void negate (inout float arr[4]);
   1996 			bool test (in float arr[4], vec4 ref);
   1997 			bool isEqual (in float a[4], in float b[4]);
   1998 
   1999 			float func (inout float a[4], inout float b[4])
   2000 			{
   2001 				negate(a);
   2002 				return isEqual(a, b) ? 1.0 : -1.0;
   2003 			}
   2004 
   2005 			void main()
   2006 			{
   2007 				float arr[4];
   2008 				set(arr, in0);
   2009 				float m = func(arr, arr); // returns -1.0
   2010 				float n = float(test(arr, in0) || test(arr, -in0));
   2011 				out0 = in0 * m * n;
   2012 				${OUTPUT}
   2013 			}
   2014 
   2015 			float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
   2016 			vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
   2017 			void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
   2018 			void negate (inout float arr[4]) { set(arr, -get(arr)); }
   2019 			bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
   2020 			bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
   2021 		""
   2022 	end
   2023 
   2024 	case copy_global_inout_on_call
   2025 		desc "Check that global 'in' arguments are copied on call and don't alias."
   2026 		values
   2027 		{
   2028 			input vec4 in0		= [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
   2029 			output vec4 out0	= [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
   2030 		}
   2031 
   2032 		both ""
   2033 			precision mediump float;
   2034 			${DECLARATIONS}
   2035 
   2036 			vec4 get (in float arr[4]);
   2037 			void set (out float arr[4], vec4 val);
   2038 			void negate (inout float arr[4]);
   2039 			bool test (in float arr[4], vec4 ref);
   2040 			bool isEqual (in float a[4], in float b[4]);
   2041 
   2042 			float func (in float a[4], in float b[4])
   2043 			{
   2044 				negate(a);
   2045 				return isEqual(a, b) ? 1.0 : -1.0;
   2046 			}
   2047 
   2048 			float arr[4];
   2049 
   2050 			void main()
   2051 			{
   2052 				set(arr, in0);
   2053 				float m = func(arr, arr); // returns -1.0
   2054 				float n = float(test(arr, in0) || test(arr, -in0));
   2055 				out0 = in0 * m * n;
   2056 				${OUTPUT}
   2057 			}
   2058 
   2059 			float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
   2060 			vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
   2061 			void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
   2062 			void negate (inout float arr[4]) { set(arr, -get(arr)); }
   2063 			bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
   2064 			bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
   2065 		""
   2066 	end
   2067 
   2068 #			vec4 get (in float arr[4]);
   2069 #			void set (out float arr[4], vec4 val);
   2070 #			void negate (inout float arr[4]);
   2071 #			bool test (in float arr[4], vec4 ref);
   2072 #			bool isEqual (in float a[4], in float b[4]);
   2073 
   2074 #			float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
   2075 #			vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
   2076 #			void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
   2077 #			void negate (inout float arr[4]) { set(arr, -get(arr)); }
   2078 #			bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
   2079 #			bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
   2080 
   2081 end # array_arguments
   2082 
   2083 #group qualifiers "Function Parameter Qualifiers"
   2084 #
   2085 #end # qualifiers
   2086 
   2087 group control_flow "Control Flow In Functions"
   2088 
   2089 	case simple_return
   2090 		values
   2091 		{
   2092 			input float in0		= [ -0.5 | 1.5 ];
   2093 			output float out0	= [ 0.5 | -1.5 ];
   2094 		}
   2095 
   2096 		both ""
   2097 			precision mediump float;
   2098 			${DECLARATIONS}
   2099 
   2100 			float func (float a)
   2101 			{
   2102 				return -a;
   2103 				a = a * -1.0;
   2104 				return 1.0;
   2105 			}
   2106 
   2107 			void main()
   2108 			{
   2109 				${SETUP}
   2110 				out0 = func(in0);
   2111 				${OUTPUT}
   2112 			}
   2113 		""
   2114 	end
   2115 
   2116 	case return_in_if
   2117 		values
   2118 		{
   2119 			input float in0		= [ -0.5 | 1.5 ];
   2120 			output float out0	= [ 0.5 | -1.5 ];
   2121 		}
   2122 
   2123 		both ""
   2124 			precision mediump float;
   2125 			${DECLARATIONS}
   2126 
   2127 			float func (float a)
   2128 			{
   2129 				if (a != 0.0)
   2130 					return -a;
   2131 				return 1.0;
   2132 			}
   2133 
   2134 			void main()
   2135 			{
   2136 				${SETUP}
   2137 				out0 = func(in0);
   2138 				${OUTPUT}
   2139 			}
   2140 		""
   2141 	end
   2142 
   2143 	case return_in_else
   2144 		values
   2145 		{
   2146 			input float in0		= [ -0.5 | 1.5 ];
   2147 			output float out0	= [ 0.5 | -1.5 ];
   2148 		}
   2149 
   2150 		both ""
   2151 			precision mediump float;
   2152 			${DECLARATIONS}
   2153 
   2154 			float func (float a)
   2155 			{
   2156 				if (a == 0.0)
   2157 					return 1.0;
   2158 				else
   2159 					return -a;
   2160 				return 1.0;
   2161 			}
   2162 
   2163 			void main()
   2164 			{
   2165 				${SETUP}
   2166 				out0 = func(in0);
   2167 				${OUTPUT}
   2168 			}
   2169 		""
   2170 	end
   2171 
   2172 	case return_in_loop
   2173 		values
   2174 		{
   2175 			input float in0		= [ -0.5 | 1.5 ];
   2176 			output float out0	= [ 0.5 | -1.5 ];
   2177 		}
   2178 
   2179 		both ""
   2180 			precision mediump float;
   2181 			${DECLARATIONS}
   2182 
   2183 			float func (float a)
   2184 			{
   2185 				for (int i = 0; i < 1; i++)
   2186 					return -a;
   2187 				return 1.0;
   2188 			}
   2189 
   2190 			void main()
   2191 			{
   2192 				${SETUP}
   2193 				out0 = func(in0);
   2194 				${OUTPUT}
   2195 			}
   2196 		""
   2197 	end
   2198 
   2199 	case return_in_loop_if
   2200 		values
   2201 		{
   2202 			input float in0		= [ -0.5 | 1.5 ];
   2203 			output float out0	= [ 0.5 | -1.5 ];
   2204 		}
   2205 
   2206 		both ""
   2207 			precision mediump float;
   2208 			${DECLARATIONS}
   2209 
   2210 			float func (float a)
   2211 			{
   2212 				for (int i = 0; i < 3; i++)
   2213 				{
   2214 					if (i == 1)
   2215 						return a;
   2216 					else if (i > 1)
   2217 						return -1.0;
   2218 					a = -a;
   2219 				}
   2220 				return 1.0;
   2221 			}
   2222 
   2223 			void main()
   2224 			{
   2225 				${SETUP}
   2226 				out0 = func(in0);
   2227 				${OUTPUT}
   2228 			}
   2229 		""
   2230 	end
   2231 
   2232 	case return_after_loop
   2233 		values
   2234 		{
   2235 			input float in0		= [ -0.5 | 1.5 ];
   2236 			output float out0	= [ 0.5 | -1.5 ];
   2237 		}
   2238 
   2239 		both ""
   2240 			precision mediump float;
   2241 			${DECLARATIONS}
   2242 
   2243 			float func (float a)
   2244 			{
   2245 				for (int i = 0; i < 5; i++)
   2246 					a = -a;
   2247 				return a;
   2248 			}
   2249 
   2250 			void main()
   2251 			{
   2252 				${SETUP}
   2253 				out0 = func(in0);
   2254 				${OUTPUT}
   2255 			}
   2256 		""
   2257 	end
   2258 
   2259 	case return_after_break
   2260 		values
   2261 		{
   2262 			input float in0		= [ -0.5 | 1.5 ];
   2263 			output float out0	= [ 0.5 | -1.5 ];
   2264 		}
   2265 
   2266 		both ""
   2267 			precision mediump float;
   2268 			${DECLARATIONS}
   2269 
   2270 			float func (float a)
   2271 			{
   2272 				for (int i = 0; i < 6; i++)
   2273 				{
   2274 					a = -a;
   2275 					if (i == 4)
   2276 						break;
   2277 				}
   2278 				return a;
   2279 			}
   2280 
   2281 			void main()
   2282 			{
   2283 				${SETUP}
   2284 				out0 = func(in0);
   2285 				${OUTPUT}
   2286 			}
   2287 		""
   2288 	end
   2289 
   2290 	case return_after_continue
   2291 		values
   2292 		{
   2293 			input float in0		= [ -0.5 | 1.5 ];
   2294 			output float out0	= [ 0.5 | -1.5 ];
   2295 		}
   2296 
   2297 		both ""
   2298 			precision mediump float;
   2299 			${DECLARATIONS}
   2300 
   2301 			float func (float a)
   2302 			{
   2303 				for (int i = 0; i < 6; i++)
   2304 				{
   2305 					if (i == 4)
   2306 						continue;
   2307 					a = -a;
   2308 				}
   2309 				return a;
   2310 			}
   2311 
   2312 			void main()
   2313 			{
   2314 				${SETUP}
   2315 				out0 = func(in0);
   2316 				${OUTPUT}
   2317 			}
   2318 		""
   2319 	end
   2320 
   2321 	case return_in_nested_loop
   2322 		values
   2323 		{
   2324 			input float in0		= [ -0.5 | 1.5 ];
   2325 			output float out0	= [ 0.5 | -1.5 ];
   2326 		}
   2327 
   2328 		both ""
   2329 			precision mediump float;
   2330 			${DECLARATIONS}
   2331 
   2332 			float func (float a)
   2333 			{
   2334 				for (int i = 0; i < 6; i++)
   2335 				{
   2336 					a = -a;
   2337 					for (int j = 0; j < 4; j++)
   2338 					{
   2339 						a = -a;
   2340 						if (i == 1)
   2341 							return a;
   2342 					}
   2343 					if (i == 4)
   2344 						return 1.0;
   2345 				}
   2346 				return 1.0;
   2347 			}
   2348 
   2349 			void main()
   2350 			{
   2351 				${SETUP}
   2352 				out0 = func(in0);
   2353 				${OUTPUT}
   2354 			}
   2355 		""
   2356 	end
   2357 
   2358 	case return_after_loop_sequence
   2359 		values
   2360 		{
   2361 			input float in0		= [ -0.5 | 1.5 ];
   2362 			output float out0	= [ 0.5 | -1.5 ];
   2363 		}
   2364 
   2365 		both ""
   2366 			precision mediump float;
   2367 			${DECLARATIONS}
   2368 
   2369 			float func (float a)
   2370 			{
   2371 				for (int i = 0; i < 6; i++) // negate a
   2372 				{
   2373 					a = -a;
   2374 					if (i == 4)
   2375 						a = -a;
   2376 				}
   2377 
   2378 				for (int i = 6; i < 10; i++) // keep a
   2379 				{
   2380 					if (i == 8)
   2381 						continue;
   2382 					else if (i == 9)
   2383 						break;
   2384 					a = -a;
   2385 				}
   2386 
   2387 				return a;
   2388 			}
   2389 
   2390 			void main()
   2391 			{
   2392 				${SETUP}
   2393 				out0 = func(in0);
   2394 				${OUTPUT}
   2395 			}
   2396 		""
   2397 	end
   2398 
   2399 	case mixed_return_break_continue
   2400 		values
   2401 		{
   2402 			input float in0		= [ -0.5 | 1.5 ];
   2403 			output float out0	= [ 0.5 | -1.5 ];
   2404 		}
   2405 
   2406 		both ""
   2407 			precision mediump float;
   2408 			${DECLARATIONS}
   2409 
   2410 			float func (float a)
   2411 			{
   2412 				for (int i = 0; i < 6; i++)
   2413 				{
   2414 					if (i == 0)
   2415 						continue;
   2416 					else if (i == 1)
   2417 					{
   2418 					}
   2419 					else if (i == 3)
   2420 						break;
   2421 					else
   2422 						return a;
   2423 					a = -a;
   2424 				}
   2425 
   2426 				return 1.0;
   2427 			}
   2428 
   2429 			void main()
   2430 			{
   2431 				${SETUP}
   2432 				out0 = func(in0);
   2433 				${OUTPUT}
   2434 			}
   2435 		""
   2436 	end
   2437 
   2438 end # control_flow
   2439 
   2440 group misc "Miscellaneous"
   2441 
   2442 	case multi_arg_float
   2443 		values
   2444 		{
   2445 			input vec4 in0		= [ vec4(0.0, 1.0, -2.0, 0.5) | vec4(2.0, 2.5, 4.0, -7.0) ];
   2446 			output float out0	= [ 0.5 | -1.5 ]; # -sum(in0)
   2447 		}
   2448 
   2449 		both ""
   2450 			precision mediump float;
   2451 			${DECLARATIONS}
   2452 
   2453 			float sum(vec4 v) { return (v.x + v.y + v.z + v.w); }
   2454 
   2455 			float func (float a, vec3 b, vec2 c, vec2 d, vec4 e)
   2456 			{
   2457 				return -sum(vec4(a, b) + vec4(c, d)) + sum(e);
   2458 			}
   2459 
   2460 			void main()
   2461 			{
   2462 				${SETUP}
   2463 				out0 = func(in0.y, in0.xzw, in0.wz, in0.yx, in0);
   2464 				${OUTPUT}
   2465 			}
   2466 		""
   2467 	end
   2468 
   2469 	case multi_arg_int
   2470 		values
   2471 		{
   2472 			input ivec4 in0		= [ ivec4(-1, 0, 2, 2) | ivec4(1, 4, -8, 2) ];
   2473 			output int out0		= [ -3 | 1 ];
   2474 		}
   2475 
   2476 		both ""
   2477 			precision mediump float;
   2478 			precision mediump int;
   2479 			${DECLARATIONS}
   2480 
   2481 			int sum(ivec4 v) { return (v.x + v.y + v.z + v.w); }
   2482 
   2483 			int func (int a, ivec3 b, ivec2 c, ivec2 d, ivec4 e)
   2484 			{
   2485 				return -sum(ivec4(a, b) + ivec4(c, d)) + sum(e);
   2486 			}
   2487 
   2488 			void main()
   2489 			{
   2490 				${SETUP}
   2491 				out0 = func(in0.y, in0.xzw, in0.wz, in0.yx, in0);
   2492 				${OUTPUT}
   2493 			}
   2494 		""
   2495 	end
   2496 
   2497 	case argument_eval_order_1
   2498 		values
   2499 		{
   2500 			input int in0	= [  0 | 1 | 3 | 5 ];
   2501 			output int out0	= [ -1 | 5 | 11 | 17 ];
   2502 		}
   2503 
   2504 		both ""
   2505 			precision mediump float;
   2506 			${DECLARATIONS}
   2507 
   2508 			int func (float a, int b, bool c, int d)
   2509 			{
   2510 				if (c)
   2511 					return b + int(a) + d;
   2512 				else
   2513 					return -1;
   2514 			}
   2515 
   2516 			void main ()
   2517 			{
   2518 				${SETUP}
   2519 				float v0 = float(in0);
   2520 				int v1 = in0;
   2521 				out0 = func((v0 += 1.0), v1++, (v0 > 1.5), v1);
   2522 				${OUTPUT}
   2523 			}
   2524 		""
   2525 	end
   2526 
   2527 	case argument_eval_order_2
   2528 		values
   2529 		{
   2530 			input int in0	= [ 0 | -1 | 3 | 5 ];
   2531 			output int out0	= [ 3 | -1 | 9 | 13 ];
   2532 		}
   2533 
   2534 		both ""
   2535 			precision mediump float;
   2536 			${DECLARATIONS}
   2537 
   2538 			int g;
   2539 
   2540 			int modG (int v)
   2541 			{
   2542 				g += v;
   2543 				return v;
   2544 			}
   2545 
   2546 			int func (float a, int b, bool c, int d)
   2547 			{
   2548 				if (c)
   2549 					return b + int(a) + d;
   2550 				else
   2551 					return -1;
   2552 			}
   2553 
   2554 			void main ()
   2555 			{
   2556 				${SETUP}
   2557 				out0 = func(float(g = in0), modG(2), --g > 0, g);
   2558 				${OUTPUT}
   2559 			}
   2560 		""
   2561 	end
   2562 
   2563 	case missing_returns
   2564 		values
   2565 		{
   2566 			input float in0 = [ 1.0 | 2.0 | 3.0 ];
   2567 			output float out0 = [ -1.0 | -2.0 | -3.0 ];
   2568 		}
   2569 		both ""
   2570 			// Note specification says that returned value is undefined if no return
   2571 			// statement has been executed. In this case func() is called only with
   2572 			// positive values.
   2573 			precision mediump float;
   2574 			${DECLARATIONS}
   2575 
   2576 			float func (float f)
   2577 			{
   2578 				if (f > 0.0)
   2579 					return -f;
   2580 			}
   2581 
   2582 			void main ()
   2583 			{
   2584 				${SETUP}
   2585 				out0 = func(in0);
   2586 				${OUTPUT}
   2587 			}
   2588 		""
   2589 	end
   2590 
   2591 end # misc
   2592 
   2593 group invalid "Invalid Functions"
   2594 	case break_in_body
   2595 		expect compile_fail
   2596 		both ""
   2597 			precision mediump float;
   2598 
   2599 			void func ()
   2600 			{
   2601 				break;
   2602 			}
   2603 
   2604 			void main ()
   2605 			{
   2606 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2607 			}
   2608 		""
   2609 	end
   2610 
   2611 	case continue_in_body
   2612 		expect compile_fail
   2613 		both ""
   2614 			precision mediump float;
   2615 
   2616 			void func ()
   2617 			{
   2618 				continue;
   2619 			}
   2620 
   2621 			void main ()
   2622 			{
   2623 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2624 			}
   2625 		""
   2626 	end
   2627 
   2628 	case return_value_from_void_function
   2629 		expect compile_fail
   2630 		both ""
   2631 			precision mediump float;
   2632 
   2633 			void func ()
   2634 			{
   2635 				return 1.0;
   2636 			}
   2637 
   2638 			void main ()
   2639 			{
   2640 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2641 			}
   2642 		""
   2643 	end
   2644 
   2645 	case extra_arguments
   2646 		expect compile_fail
   2647 		both ""
   2648 			precision mediump float;
   2649 
   2650 			void func (float f)
   2651 			{
   2652 			}
   2653 
   2654 			void main ()
   2655 			{
   2656 				func(1.0, 2.0);
   2657 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2658 			}
   2659 		""
   2660 	end
   2661 
   2662 	case missing_arguments
   2663 		expect compile_fail
   2664 		both ""
   2665 			precision mediump float;
   2666 
   2667 			void func (float f)
   2668 			{
   2669 			}
   2670 
   2671 			void main ()
   2672 			{
   2673 				func();
   2674 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2675 			}
   2676 		""
   2677 	end
   2678 
   2679 	case missing_argument_type
   2680 		expect compile_fail
   2681 		both ""
   2682 			precision mediump float;
   2683 
   2684 			void func (in f)
   2685 			{
   2686 			}
   2687 
   2688 			void main ()
   2689 			{
   2690 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2691 			}
   2692 		""
   2693 	end
   2694 
   2695 	case argument_basetype_mismatch
   2696 		expect compile_fail
   2697 		both ""
   2698 			precision mediump float;
   2699 			precision mediump int;
   2700 
   2701 			void func (float f)
   2702 			{
   2703 			}
   2704 
   2705 			void main ()
   2706 			{
   2707 				func(2);
   2708 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2709 			}
   2710 		""
   2711 	end
   2712 
   2713 	case argument_scalar_vector_mismatch
   2714 		expect compile_fail
   2715 		both ""
   2716 			precision mediump float;
   2717 
   2718 			void func (vec2 f)
   2719 			{
   2720 			}
   2721 
   2722 			void main ()
   2723 			{
   2724 				func(2.0);
   2725 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2726 			}
   2727 		""
   2728 	end
   2729 
   2730 	case argument_vector_size_mismatch
   2731 		expect compile_fail
   2732 		both ""
   2733 			precision mediump float;
   2734 
   2735 			void func (vec3 f)
   2736 			{
   2737 			}
   2738 
   2739 			void main ()
   2740 			{
   2741 				func(vec2(2.0));
   2742 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2743 			}
   2744 		""
   2745 	end
   2746 
   2747 	case duplicate_function
   2748 		expect compile_fail
   2749 		both ""
   2750 			precision mediump float;
   2751 
   2752 			void func (vec3 f);
   2753 
   2754 			void func (vec3 f)
   2755 			{
   2756 			}
   2757 
   2758 			void func (vec3 f)
   2759 			{
   2760 			}
   2761 
   2762 			void main ()
   2763 			{
   2764 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2765 			}
   2766 		""
   2767 	end
   2768 
   2769 	case prototype_mismatch_return_type
   2770 		expect compile_fail
   2771 		both ""
   2772 			precision mediump float;
   2773 
   2774 			void func (vec3 f);
   2775 
   2776 			void main ()
   2777 			{
   2778 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2779 			}
   2780 
   2781 			float func (vec3 f)
   2782 			{
   2783 				return f.x;
   2784 			}
   2785 		""
   2786 	end
   2787 
   2788 	case prototype_unspecified_array_size
   2789 		expect compile_fail
   2790 		both ""
   2791 			precision mediump float;
   2792 
   2793 			void func (vec3 f[]);
   2794 
   2795 			void main ()
   2796 			{
   2797 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2798 			}
   2799 		""
   2800 	end
   2801 
   2802 	case call_mismatch_argument_array_size
   2803 		expect compile_fail
   2804 		both ""
   2805 			precision mediump float;
   2806 
   2807 			void func (vec3 f[3]);
   2808 			void func (vec3 f[3])
   2809 			{
   2810 			}
   2811 
   2812 			void main ()
   2813 			{
   2814 				vec3 array[4];
   2815 				func(array);
   2816 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2817 			}
   2818 		""
   2819 	end
   2820 
   2821 	case prototype_mismatch_argument_const
   2822 		expect compile_fail
   2823 		both ""
   2824 			precision mediump float;
   2825 
   2826 			void func (vec3 f);
   2827 			void func (const vec3 f)
   2828 			{
   2829 			}
   2830 
   2831 			void main ()
   2832 			{
   2833 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2834 			}
   2835 		""
   2836 	end
   2837 
   2838 	case prototype_mismatch_argument_array_const
   2839 		expect compile_fail
   2840 		both ""
   2841 			precision mediump float;
   2842 
   2843 			void func (vec3 f[3]);
   2844 			void func (const vec3 f[3])
   2845 			{
   2846 			}
   2847 
   2848 			void main ()
   2849 			{
   2850 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2851 			}
   2852 		""
   2853 	end
   2854 
   2855 	case prototype_mismatch_array_inout
   2856 		expect compile_fail
   2857 		both ""
   2858 			precision mediump float;
   2859 
   2860 			void func (out vec3 f);
   2861 			void func (inout vec3 f)
   2862 			{
   2863 			}
   2864 
   2865 			void main ()
   2866 			{
   2867 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2868 			}
   2869 		""
   2870 	end
   2871 
   2872 	case missing_return_type
   2873 		expect compile_fail
   2874 		both ""
   2875 			precision mediump float;
   2876 
   2877 			func (float f);
   2878 			func (inout vec3 f[3])
   2879 			{
   2880 			}
   2881 
   2882 			void main ()
   2883 			{
   2884 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2885 			}
   2886 		""
   2887 	end
   2888 
   2889 	case call_before_definition
   2890 		expect compile_fail
   2891 		both ""
   2892 			precision mediump float;
   2893 
   2894 			void main ()
   2895 			{
   2896 				func(1.0);
   2897 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2898 			}
   2899 
   2900 			void func (float f)
   2901 			{
   2902 			}
   2903 
   2904 		""
   2905 	end
   2906 
   2907 	case return_array_in_struct
   2908 		expect compile_fail
   2909 		both ""
   2910 			precision mediump float;
   2911 
   2912 			struct Foo
   2913 			{
   2914 				float f;
   2915 				float arr[2];
   2916 			};
   2917 
   2918 			Foo func ()
   2919 			{
   2920 				Foo f;
   2921 				f.f = 1.0;
   2922 				f.arr[0] = 2.0;
   2923 				return f;
   2924 			}
   2925 
   2926 			void main ()
   2927 			{
   2928 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2929 			}
   2930 		""
   2931 	end
   2932 
   2933 	case argument_precision_overload
   2934 		expect compile_fail
   2935 		both ""
   2936 			precision mediump float;
   2937 
   2938 			float func (lowp float f)
   2939 			{
   2940 				return f;
   2941 			}
   2942 
   2943 			float func (mediump float f)
   2944 			{
   2945 				return f;
   2946 			}
   2947 
   2948 			void main ()
   2949 			{
   2950 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2951 			}
   2952 		""
   2953 	end
   2954 
   2955 	case argument_in_out_overload
   2956 		expect compile_fail
   2957 		both ""
   2958 			precision mediump float;
   2959 
   2960 			void func (in float f)
   2961 			{
   2962 			}
   2963 
   2964 			void func (out float f)
   2965 			{
   2966 				f = 1.0;
   2967 			}
   2968 
   2969 			void main ()
   2970 			{
   2971 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2972 			}
   2973 		""
   2974 	end
   2975 
   2976 	case argument_in_inout_overload
   2977 		expect compile_fail
   2978 		both ""
   2979 			precision mediump float;
   2980 
   2981 			void func (in float f)
   2982 			{
   2983 			}
   2984 
   2985 			void func (inout float f)
   2986 			{
   2987 				f = -f;
   2988 			}
   2989 
   2990 			void main ()
   2991 			{
   2992 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2993 			}
   2994 		""
   2995 	end
   2996 
   2997 	case argument_out_inout_overload
   2998 		expect compile_fail
   2999 		both ""
   3000 			precision mediump float;
   3001 
   3002 			void func (out float f)
   3003 			{
   3004 				f = -1.0;
   3005 			}
   3006 
   3007 			void func (inout float f)
   3008 			{
   3009 				f = -f;
   3010 			}
   3011 
   3012 			void main ()
   3013 			{
   3014 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3015 			}
   3016 		""
   3017 	end
   3018 
   3019 	case return_type_overload
   3020 		expect compile_fail
   3021 		both ""
   3022 			precision mediump float;
   3023 
   3024 			float func (float f)
   3025 			{
   3026 				return f;
   3027 			}
   3028 
   3029 			int func (float f)
   3030 			{
   3031 				return int(f);
   3032 			}
   3033 
   3034 			void main ()
   3035 			{
   3036 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3037 			}
   3038 		""
   3039 	end
   3040 
   3041 	case return_type_precision_overload
   3042 		expect compile_fail
   3043 		both ""
   3044 			precision mediump float;
   3045 
   3046 			lowp float func (float f)
   3047 			{
   3048 				return f;
   3049 			}
   3050 
   3051 			mediump float func (float f)
   3052 			{
   3053 				return f;
   3054 			}
   3055 
   3056 			void main ()
   3057 			{
   3058 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3059 			}
   3060 		""
   3061 	end
   3062 
   3063 	case return_type_const_overload
   3064 		expect compile_fail
   3065 		both ""
   3066 			precision mediump float;
   3067 
   3068 			float func (float f)
   3069 			{
   3070 				return f;
   3071 			}
   3072 
   3073 			const float func (float f)
   3074 			{
   3075 				return f;
   3076 			}
   3077 
   3078 			void main ()
   3079 			{
   3080 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3081 			}
   3082 		""
   3083 	end
   3084 
   3085 	case return_without_value
   3086 		expect compile_fail
   3087 		both ""
   3088 			precision mediump float;
   3089 
   3090 			float func (float f)
   3091 			{
   3092 				return;
   3093 				return 1.0;
   3094 			}
   3095 
   3096 			void main ()
   3097 			{
   3098 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3099 			}
   3100 		""
   3101 	end
   3102 
   3103 	case local_function_prototype
   3104 		expect compile_fail
   3105 		both ""
   3106 			precision mediump float;
   3107 
   3108 			void main ()
   3109 			{
   3110 				float func (float f);
   3111 
   3112 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3113 			}
   3114 		""
   3115 	end
   3116 
   3117 	case local_function_definition
   3118 		expect compile_fail
   3119 		both ""
   3120 			precision mediump float;
   3121 
   3122 			void main ()
   3123 			{
   3124 				float func (float f)
   3125 				{
   3126 					return 1.0;
   3127 				}
   3128 
   3129 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3130 			}
   3131 		""
   3132 	end
   3133 
   3134 	case name_type_conflict
   3135 		expect compile_fail
   3136 		both ""
   3137 			precision mediump float;
   3138 
   3139 			struct foo { float a; }
   3140 
   3141 			float foo (float f)
   3142 			{
   3143 				return 1.0;
   3144 			}
   3145 
   3146 			void main ()
   3147 			{
   3148 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3149 			}
   3150 		""
   3151 	end
   3152 
   3153 	case const_overload
   3154 		expect compile_fail
   3155 		both ""
   3156 			precision mediump float;
   3157 
   3158 			void func (vec3 f)
   3159 			{
   3160 			}
   3161 
   3162 			void func (const vec3 f)
   3163 			{
   3164 			}
   3165 
   3166 			void main ()
   3167 			{
   3168 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3169 			}
   3170 		""
   3171 	end
   3172 
   3173 	case uniform_local
   3174 		expect compile_fail
   3175 		both ""
   3176 			precision mediump float;
   3177 
   3178 			void func (vec3 f)
   3179 			{
   3180 				uniform float u;
   3181 			}
   3182 
   3183 			void main ()
   3184 			{
   3185 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3186 			}
   3187 		""
   3188 	end
   3189 
   3190 	case varying_local
   3191 		expect compile_fail
   3192 		both ""
   3193 			precision mediump float;
   3194 
   3195 			void func (vec3 f)
   3196 			{
   3197 				varying float v;
   3198 			}
   3199 
   3200 			void main ()
   3201 			{
   3202 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3203 			}
   3204 		""
   3205 	end
   3206 
   3207 	case attribute_local
   3208 		expect compile_fail
   3209 		both ""
   3210 			precision mediump float;
   3211 
   3212 			void func (vec3 f)
   3213 			{
   3214 				attribute float a;
   3215 			}
   3216 
   3217 			void main ()
   3218 			{
   3219 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3220 			}
   3221 		""
   3222 	end
   3223 
   3224 	case uniform_argument
   3225 		expect compile_fail
   3226 		both ""
   3227 			precision mediump float;
   3228 
   3229 			void func (uniform vec3 f)
   3230 			{
   3231 			}
   3232 
   3233 			void main ()
   3234 			{
   3235 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3236 			}
   3237 		""
   3238 	end
   3239 
   3240 	case varying_argument
   3241 		expect compile_fail
   3242 		both ""
   3243 			precision mediump float;
   3244 
   3245 			void func (varying vec3 f)
   3246 			{
   3247 			}
   3248 
   3249 			void main ()
   3250 			{
   3251 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3252 			}
   3253 		""
   3254 	end
   3255 
   3256 	case attribute_argument
   3257 		expect compile_fail
   3258 		both ""
   3259 			precision mediump float;
   3260 
   3261 			void func (attribute vec3 f)
   3262 			{
   3263 			}
   3264 
   3265 			void main ()
   3266 			{
   3267 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3268 			}
   3269 		""
   3270 	end
   3271 
   3272 	case uniform_return_type
   3273 		expect compile_fail
   3274 		both ""
   3275 			precision mediump float;
   3276 
   3277 			uniform float func (vec3 f)
   3278 			{
   3279 				return f.x;
   3280 			}
   3281 
   3282 			void main ()
   3283 			{
   3284 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3285 			}
   3286 		""
   3287 	end
   3288 
   3289 	case varying_return_type
   3290 		expect compile_fail
   3291 		both ""
   3292 			precision mediump float;
   3293 
   3294 			varying float func (vec3 f)
   3295 			{
   3296 				return f.x;
   3297 			}
   3298 
   3299 			void main ()
   3300 			{
   3301 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3302 			}
   3303 		""
   3304 	end
   3305 
   3306 	case attribute_return_type
   3307 		expect compile_fail
   3308 		both ""
   3309 			precision mediump float;
   3310 
   3311 			attribute float func (vec3 f)
   3312 			{
   3313 				return f.x;
   3314 			}
   3315 
   3316 			void main ()
   3317 			{
   3318 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3319 			}
   3320 		""
   3321 	end
   3322 
   3323 	case main_invalid_return_type
   3324 		expect compile_fail
   3325 		both ""
   3326 			precision mediump float;
   3327 
   3328 			float main ()
   3329 			{
   3330 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3331 			}
   3332 		""
   3333 	end
   3334 
   3335 	case main_has_arguments
   3336 		expect compile_fail
   3337 		both ""
   3338 			precision mediump float;
   3339 
   3340 			void main (float f)
   3341 			{
   3342 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3343 			}
   3344 		""
   3345 	end
   3346 
   3347 	case main_missing_return_type
   3348 		expect compile_fail
   3349 		both ""
   3350 			precision mediump float;
   3351 
   3352 			main ()
   3353 			{
   3354 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3355 			}
   3356 		""
   3357 	end
   3358 
   3359 	case write_const_arg
   3360 		expect compile_fail
   3361 		both ""
   3362 			precision mediump float;
   3363 
   3364 			func (const float f)
   3365 			{
   3366 				f = 1.0;
   3367 			}
   3368 
   3369 			main ()
   3370 			{
   3371 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3372 			}
   3373 		""
   3374 	end
   3375 
   3376 	case write_const_array_arg
   3377 		expect compile_fail
   3378 		both ""
   3379 			precision mediump float;
   3380 
   3381 			func (const float f[3])
   3382 			{
   3383 				f[0] = 1.0;
   3384 			}
   3385 
   3386 			main ()
   3387 			{
   3388 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3389 			}
   3390 		""
   3391 	end
   3392 
   3393 	case modify_const_arg
   3394 		expect compile_fail
   3395 		both ""
   3396 			precision mediump float;
   3397 			precision mediump int;
   3398 			${DECLARATIONS}
   3399 
   3400 			int func (const int a)
   3401 			{
   3402 				a = -a;
   3403 				return 2 * a;
   3404 			}
   3405 
   3406 			void main()
   3407 			{
   3408 				${POSITION_FRAG_COLOR} = vec4(func(3));
   3409 			}
   3410 		""
   3411 	end
   3412 
   3413 	case init_const_local_from_const_arg
   3414 		expect compile_fail
   3415 		both ""
   3416 			precision mediump float;
   3417 			precision mediump int;
   3418 			${DECLARATIONS}
   3419 
   3420 			int func (const int a)
   3421 			{
   3422 				const int b = -a;
   3423 				return 2 * b;
   3424 			}
   3425 
   3426 			void main()
   3427 			{
   3428 				${POSITION_FRAG_COLOR} = vec4(func(3));
   3429 			}
   3430 		""
   3431 	end
   3432 
   3433 	case array_size_from_const_arg
   3434 		expect compile_fail
   3435 		both ""
   3436 			precision mediump float;
   3437 			precision mediump int;
   3438 			${DECLARATIONS}
   3439 
   3440 			int func (const int a)
   3441 			{
   3442 				int arr[a];
   3443 				arr[1] = 3;
   3444 				return arr[1];
   3445 			}
   3446 
   3447 			void main()
   3448 			{
   3449 				${POSITION_FRAG_COLOR} = vec4(func(3));
   3450 			}
   3451 		""
   3452 	end
   3453 
   3454 	case double_declare
   3455 		expect compile_fail
   3456 		both ""
   3457 			precision mediump float;
   3458 			${DECLARATIONS}
   3459 
   3460 			float func (float f);
   3461 			float func (float f);
   3462 
   3463 			float func (float f)
   3464 			{
   3465 				return -f;
   3466 			}
   3467 
   3468 			void main()
   3469 			{
   3470 				${POSITION_FRAG_COLOR} = vec4(func(1.0));
   3471 			}
   3472 		""
   3473 	end
   3474 
   3475 end # invalid