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