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)
8 # - control flow: return, return in loop, etc.
10 group datatypes "Function Parameter Data Types"
16 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
17 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
22 precision mediump float;
42 input vec2 in0 = [ vec2(0.0, 1.0) | vec2(2.0, 2.5) ];
43 output float out0 = [ -1.0 | -4.5 ];
48 precision mediump float;
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 ];
74 precision mediump float;
79 return -(a.x + a.y + a.z);
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 ];
100 precision mediump float;
105 return -(a.x + a.y + a.z + a.w);
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 ];
126 precision mediump float;
131 return -(a[0][0] + a[0][1] + a[1][0] + a[1][1]);
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 ];
152 precision mediump float;
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]);
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 ];
178 precision mediump float;
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]);
198 input int in0 = [ -1 | 0 | 1 | 4 ];
199 output int out0 = [ 1 | 0 | -1 | -4 ];
204 precision mediump float;
205 precision mediump int;
226 input ivec2 in0 = [ ivec2(-1, 0) | ivec2(1, 4) ];
227 output int out0 = [ 1 | -5 ];
232 precision mediump float;
233 precision mediump int;
254 input ivec3 in0 = [ ivec3(-1, 0, 2) | ivec3(1, 4, -8) ];
255 output int out0 = [ -1 | 3 ];
260 precision mediump float;
261 precision mediump int;
266 return -(a.x + a.y + a.z);
282 input ivec4 in0 = [ ivec4(-1, 0, 2, 2) | ivec4(1, 4, -8, 2) ];
283 output int out0 = [ -3 | 1 ];
288 precision mediump float;
289 precision mediump int;
294 return -(a.x + a.y + a.z + a.w);
310 input uint in0 = [ 1 | 0 | 2 | 4 ];
311 output uint out0 = [ 1 | 0 | 4 | 16 ];
316 precision mediump float;
317 precision mediump int;
338 input uvec2 in0 = [ uvec2(1, 0) | uvec2(2, 4) ];
339 output uint out0 = [ 1 | 6 ];
344 precision mediump float;
345 precision mediump int;
366 input uvec3 in0 = [ uvec3(1, 0, 2) | uvec3(1, 4, 8) ];
367 output uint out0 = [ 3 | 13 ];
372 precision mediump float;
373 precision mediump int;
378 return (a.x + a.y + a.z);
394 input uvec4 in0 = [ uvec4(1, 0, 2, 2) | uvec4(1, 4, 8, 2) ];
395 output uint out0 = [ 5 | 15 ];
400 precision mediump float;
401 precision mediump int;
406 return (a.x + a.y + a.z + a.w);
422 input bool in0 = [ true | false ];
423 output bool out0 = [ false | true ];
428 precision mediump float;
449 input bvec2 in0 = [ bvec2(true, true) | bvec2(false, true) ];
450 output bool out0 = [ false | true ];
455 precision mediump float;
460 return !(a.x == a.y);
476 input bvec3 in0 = [ bvec3(true, true, false) | bvec3(true, false, false) ];
477 output bool out0 = [ false | true ];
482 precision mediump float;
487 return (a.x == a.y) == a.z;
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 ];
509 precision mediump float;
514 return ((a.x == a.y) == (a.z == a.w));
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) ];
536 precision mediump float;
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) ];
564 precision mediump float;
567 mat2x3 func (mat2x3 a)
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) ];
592 precision mediump float;
595 mat2x4 func (mat2x4 a)
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) ];
620 precision mediump float;
623 mat3x2 func (mat3x2 a)
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) ];
648 precision mediump float;
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) ];
676 precision mediump float;
679 mat3x4 func (mat3x4 a)
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) ];
704 precision mediump float;
707 mat4x2 func (mat4x2 a)
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) ];
732 precision mediump float;
735 mat4x3 func (mat4x3 a)
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) ];
760 precision mediump float;
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 ];
787 precision mediump float;
790 struct Pos { float a, b, c; };
794 return -(p.a + p.b + p.c);
799 Pos p = Pos(in0.x, in0.y, in0.z);
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 ];
816 precision mediump float;
819 struct Pos { float a, b, c; };
823 return Pos(-p.a, -p.b, -p.c);
828 Pos p = Pos(in0.x, in0.y, in0.z);
830 out0 = p.a + p.b + p.c;
836 case struct_nested_struct
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 ];
846 precision mediump float;
849 struct Pos { float a, b, c; };
850 struct Line { Pos start, end; };
854 return Line(p, Pos(-p.a, -p.b, -p.c));
859 return (p.a + p.b + p.c);
864 Pos p = Pos(in0.x, in0.y, in0.z);
866 out0 = sum(line.start) + (2.0 * sum(line.end));
872 case struct_constructor_highp_in_fragment
874 desc "passing highp vector to struct constructor in fragment shader yields all zeros"
877 ${VERTEX_DECLARATIONS}
885 ${FRAGMENT_DECLARATIONS}
886 #ifdef GL_FRAGMENT_PRECISION_HIGH
887 #define PRECISION highp
889 #define PRECISION mediump
892 PRECISION vec3 color;
895 PRECISION vec3 color = vec3(0.2, 2.0, 0.1);
896 Test test = Test(color);
897 // Bias the color so all components are guaranteed > 1.0.
898 ${FRAG_COLOR} = vec4(vec3(0.25, 0.55, 0.65) + vec3(4.0, 0.25, 4.0) * test.color, 1.0);
906 group qualifiers "Function Parameter Qualifiers"
912 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
913 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
918 precision mediump float;
919 precision mediump int;
922 float func (in float a)
943 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
944 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
949 precision mediump float;
950 precision mediump int;
953 void func (out float a)
973 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
974 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
979 precision mediump float;
980 precision mediump int;
983 void func (inout float a)
1003 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1004 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1009 precision mediump float;
1010 precision mediump int;
1013 float func (in lowp float a)
1034 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1035 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1040 precision mediump float;
1041 precision mediump int;
1044 void func (out lowp float a)
1060 case inout_lowp_float
1064 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1065 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1070 precision mediump float;
1071 precision mediump int;
1074 void func (inout lowp float a)
1094 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1095 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1100 precision mediump float;
1101 precision mediump int;
1104 float func (in highp float a)
1121 case out_highp_float
1125 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1126 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1131 precision mediump float;
1132 precision mediump int;
1135 void func (out highp float a)
1151 case inout_highp_float
1155 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1156 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1161 precision mediump float;
1162 precision mediump int;
1165 void func (inout highp float a)
1185 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1186 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1191 precision mediump float;
1192 precision mediump int;
1195 float func (const float a)
1216 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1217 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1222 precision mediump float;
1223 precision mediump int;
1226 float func (const in float a)
1247 input int in0 = [ 0 | 1 | -2 | 4 ];
1248 output int out0 = [ 0 | -1 | 2 | -4 ];
1253 precision mediump float;
1254 precision mediump int;
1278 input int in0 = [ 0 | 1 | -2 | 6 ];
1279 output int out0 = [ 0 | -1 | 2 | -6 ];
1284 precision mediump float;
1285 precision mediump int;
1288 void func (out int a)
1308 input int in0 = [ 0 | 1 | -2 | 6 ];
1309 output int out0 = [ 0 | -1 | 2 | -6 ];
1314 precision mediump float;
1315 precision mediump int;
1318 void func (inout int a)
1338 input int in0 = [ 0 | 1 | -2 | 4 ];
1339 output int out0 = [ 0 | -1 | 2 | -4 ];
1344 precision mediump float;
1345 precision mediump int;
1348 int func (in lowp int a)
1369 input int in0 = [ 0 | 1 | -2 | 6 ];
1370 output int out0 = [ 0 | -1 | 2 | -6 ];
1375 precision mediump float;
1376 precision mediump int;
1379 void func (out lowp int a)
1399 input int in0 = [ 0 | 1 | -2 | 6 ];
1400 output int out0 = [ 0 | -1 | 2 | -6 ];
1405 precision mediump float;
1406 precision mediump int;
1409 void func (inout lowp int a)
1429 input int in0 = [ 0 | 1 | -2 | 4 ];
1430 output int out0 = [ 0 | -1 | 2 | -4 ];
1435 precision mediump float;
1436 precision mediump int;
1439 int func (in highp int a)
1460 input int in0 = [ 0 | 1 | -2 | 6 ];
1461 output int out0 = [ 0 | -1 | 2 | -6 ];
1466 precision mediump float;
1467 precision mediump int;
1470 void func (out highp int a)
1486 case inout_highp_int
1490 input int in0 = [ 0 | 1 | -2 | 6 ];
1491 output int out0 = [ 0 | -1 | 2 | -6 ];
1496 precision mediump float;
1497 precision mediump int;
1500 void func (inout highp int a)
1520 input int in0 = [ 0 | 1 | -2 | 4 ];
1521 output int out0 = [ 0 | -1 | 2 | -4 ];
1526 precision mediump float;
1527 precision mediump int;
1530 int func (const int a)
1551 input int in0 = [ 0 | 1 | -2 | 4 ];
1552 output int out0 = [ 0 | -1 | 2 | -4 ];
1557 precision mediump float;
1558 precision mediump int;
1561 int func (const in int a)
1582 input bool in0 = [ true | false ];
1583 output bool out0 = [ true | true ];
1588 precision mediump float;
1591 bool func (in bool a)
1612 input bool in0 = [ true | false ];
1613 output bool out0 = [ false | true ];
1618 precision mediump float;
1621 void func (out bool a)
1641 input bool in0 = [ true | false ];
1642 output bool out0 = [ false | true ];
1647 precision mediump float;
1650 void func (inout bool a)
1670 input bool in0 = [ true | false ];
1671 output bool out0 = [ true | true ];
1676 precision mediump float;
1679 bool func (const bool a)
1698 group declarations "Function Declarations"
1704 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1705 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1710 precision mediump float;
1722 out0 = func() * in0;
1732 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1733 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1738 precision mediump float;
1741 float func (float f);
1743 float func (float f)
1756 case define_after_use
1760 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1761 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1766 precision mediump float;
1773 out0 = func() * in0;
1788 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1789 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1794 precision mediump float;
1808 out0 = func() * in0;
1814 case declare_after_define
1818 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1819 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1824 precision mediump float;
1836 out0 = func() * in0;
1842 case void_vs_no_void
1846 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1847 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1852 precision mediump float;
1859 out0 = func() * in0;
1874 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1875 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1880 precision mediump float;
1883 float func (float f);
1891 float func (in float f)
1898 case default_vs_explicit_precision
1902 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1903 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1908 precision mediump float;
1911 float func (float f);
1919 float func (mediump float f)
1929 group overloading "Function Overloading"
1931 case user_func_arg_type_simple
1935 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1936 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1941 precision mediump float;
1942 precision mediump int;
1945 float func (float a)
1957 out0 = func(in0) * float(func(-1));
1963 case user_func_arg_float_types
1967 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
1968 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
1973 precision mediump float;
1974 precision mediump int;
1977 float func (float a) { return -a; }
1978 vec2 func (vec2 a) { return a.yx; }
1979 vec3 func (vec3 a) { return a.xxx; }
1980 vec4 func (vec4 a) { return a.wwww; }
1984 out0 = func(func(func(func(vec4(in0)).xyz).xy).x);
1990 case user_func_arg_int_types
1994 input int in0 = [ 0 | 1 | -2 | 6 ];
1995 output int out0 = [ 0 | -1 | 2 | -6 ];
2000 precision mediump float;
2001 precision mediump int;
2004 int func (int a) { return -a; }
2005 ivec2 func (ivec2 a) { return a.yx; }
2006 ivec3 func (ivec3 a) { return a.xxx; }
2007 ivec4 func (ivec4 a) { return a.wwww; }
2012 out0 = func(func(func(func(ivec4(in0)).xyz).xy).x);
2018 case user_func_arg_bool_types
2022 input bool in0 = [ true | false ];
2023 output bool out0 = [ false | true ];
2028 precision mediump float;
2031 bool func (bool a) { return !a; }
2032 bvec2 func (bvec2 a) { return a.yx; }
2033 bvec3 func (bvec3 a) { return a.xxx; }
2034 bvec4 func (bvec4 a) { return a.wwww; }
2039 out0 = func(func(func(func(bvec4(in0)).xyz).xy).x);
2045 case user_func_arg_basic_types
2049 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
2050 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
2055 precision mediump float;
2056 precision mediump int;
2059 float func (float a) { return -a; }
2060 vec2 func (vec2 a) { return a.yx; }
2061 vec3 func (vec3 a) { return a.xxx; }
2062 vec4 func (vec4 a) { return a.wwww; }
2063 int func (int a) { return -a; }
2064 ivec2 func (ivec2 a) { return a.yx; }
2065 ivec3 func (ivec3 a) { return a.xxx; }
2066 ivec4 func (ivec4 a) { return a.wwww; }
2067 bool func (bool a) { return !a; }
2068 bvec2 func (bvec2 a) { return a.yx; }
2069 bvec3 func (bvec3 a) { return a.xxx; }
2070 bvec4 func (bvec4 a) { return a.wwww; }
2075 if (func(func(bvec4(false)).x))
2076 out0 = func(in0) * float(func(-1));
2078 out0 = float(func(func(ivec4(func(func(func(vec4(0.5)).xyz).xy).xxxx)).xy).x);
2084 case user_func_arg_complex_types
2088 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
2089 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
2094 precision mediump float;
2095 precision mediump int;
2098 struct Pos { float a, b, c; };
2099 struct Line { Pos start, end; };
2101 float func (float a) { return -a; }
2102 float func (float a[4]) { return a[0] + a[3]; }
2103 vec2 func (vec2 a) { return a.yx; }
2104 vec3 func (vec3 a) { return a.xxx; }
2105 vec4 func (vec4 a) { return a.wwww; }
2106 vec4 func (vec4 a[4]) { return a[1] + a[2]; }
2107 int func (int a) { return -a; }
2108 ivec2 func (ivec2 a) { return a.yx; }
2109 ivec3 func (ivec3 a) { return a.xxx; }
2110 ivec4 func (ivec4 a) { return a.wwww; }
2111 bool func (bool a) { return !a; }
2112 bvec2 func (bvec2 a) { return a.yx; }
2113 bvec3 func (bvec3 a) { return a.xxx; }
2114 bvec4 func (bvec4 a) { return a.wwww; }
2115 Pos func (Pos a) { return a; }
2116 Line func (Line a) { return Line(a.end, a.start); }
2123 out0 = func(arr) + func(arr2).x;
2124 if (func(func(bvec4(false)).x))
2125 out0 = func(in0) * float(func(-1));
2127 out0 = float(func(func(ivec4(func(func(func(vec4(0.5)).xyz).xy).xxxx)).xy).x);
2133 case user_func_arguments
2137 input float in0 = [ 0.0 | 1.0 | -2.0 | 2.5 ];
2138 output float out0 = [ 0.0 | -1.0 | 2.0 | -2.5 ];
2143 precision mediump float;
2146 float func (float a)
2151 float func (float a, float b)
2158 out0 = func(in0) * func(-0.5, -2.0);
2168 output float out0 = [ 1.0 ];
2173 precision mediump float;
2176 float func (float f[3])
2181 float func (float f[4])
2189 float[4] x = float[4] (-1.0, 1.0, 0.0, 0.0);
2198 group array_arguments "Arrays as Arguments"
2204 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2205 output vec4 out0 = [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
2210 precision mediump float;
2213 float func (in float a[4])
2228 float f = func(arr);
2229 out0 = f * vec4(arr[0], arr[1], arr[2], arr[3]);
2235 case global_in_float
2239 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2240 output vec4 out0 = [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
2245 precision mediump float;
2248 float func (in float a[4])
2264 float f = func(arr);
2265 out0 = f * vec4(arr[0], arr[1], arr[2], arr[3]);
2275 input ivec4 in0 = [ ivec4(0, 1, 2, -4) | ivec4(-7, -11, 13, 19) ];
2276 output ivec4 out0 = [ ivec4(0, -1, -2, 4) | ivec4(7, 11, -13, -19) ];
2281 precision mediump float;
2282 precision mediump int;
2285 int func (in int a[4])
2302 out0 = f * ivec4(arr[0], arr[1], arr[2], arr[3]);
2312 input ivec4 in0 = [ ivec4(0, 1, 2, 4) | ivec4(-7, -11, 13, 19) ];
2313 output ivec4 out0 = [ ivec4(0, -1, -2, -4) | ivec4(7, 11, -13, -19) ];
2318 precision mediump float;
2319 precision mediump int;
2322 int func (in int a[4])
2340 out0 = f * ivec4(arr[0], arr[1], arr[2], arr[3]);
2351 input bvec4 in0 = [ bvec4(true, true, false, true) | bvec4(false, false, false, false) ];
2352 output bvec4 out0 = [ bvec4(false, false, true, false) | bvec4(true, true, true, true) ];
2357 precision mediump float;
2360 bool func (in bool a[4])
2377 out0 = bvec4(arr[0], arr[1], arr[2], arr[3]);
2387 input bvec4 in0 = [ bvec4(true, true, false, true) | bvec4(false, false, false, false) ];
2388 output bvec4 out0 = [ bvec4(false, false, true, false) | bvec4(true, true, true, true) ];
2393 precision mediump float;
2396 bool func (in bool a[4])
2414 out0 = bvec4(arr[0], arr[1], arr[2], arr[3]);
2422 desc "Check that helper functions are supported properly."
2425 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2426 output float out0 = [ 1.0 | 1.0 ];
2431 precision mediump float;
2434 vec4 get (in float arr[4]);
2435 void set (out float arr[4], vec4 val);
2436 void negate (inout float arr[4]);
2437 bool test (in float arr[4], vec4 ref);
2438 bool isEqual (in float a[4], in float b[4]);
2445 out0 = float(test(arr, -in0));
2449 float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
2450 vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
2451 void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
2452 void negate (inout float arr[4]) { set(arr, -get(arr)); }
2453 bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
2454 bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
2458 case copy_local_in_on_call
2460 desc "Check that local 'in' arguments are copied on call and don't alias."
2463 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2464 output vec4 out0 = [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
2469 precision mediump float;
2472 vec4 get (in float arr[4]);
2473 void set (out float arr[4], vec4 val);
2474 void negate (inout float arr[4]);
2475 bool test (in float arr[4], vec4 ref);
2476 bool isEqual (in float a[4], in float b[4]);
2478 float func (in float a[4], in float b[4])
2482 return isEqual(a, b) ? 1.0 : -1.0;
2489 out0 = in0 * func(arr, arr);
2493 float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
2494 vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
2495 void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
2496 void negate (inout float arr[4]) { set(arr, -get(arr)); }
2497 bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
2498 bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
2502 case copy_global_in_on_call
2504 desc "Check that global 'in' arguments are copied on call and don't alias."
2507 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2508 output vec4 out0 = [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
2513 precision mediump float;
2516 vec4 get (in float arr[4]);
2517 void set (out float arr[4], vec4 val);
2518 void negate (inout float arr[4]);
2519 bool test (in float arr[4], vec4 ref);
2520 bool isEqual (in float a[4], in float b[4]);
2522 float func (in float a[4], in float b[4])
2526 return isEqual(a, b) ? 1.0 : -1.0;
2534 out0 = in0 * func(arr, arr);
2538 float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
2539 vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
2540 void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
2541 void negate (inout float arr[4]) { set(arr, -get(arr)); }
2542 bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
2543 bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
2547 case copy_local_inout_on_call
2549 desc "Check that local 'in' arguments are copied on call and don't alias."
2552 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2553 output vec4 out0 = [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
2558 precision mediump float;
2561 vec4 get (in float arr[4]);
2562 void set (out float arr[4], vec4 val);
2563 void negate (inout float arr[4]);
2564 bool test (in float arr[4], vec4 ref);
2565 bool isEqual (in float a[4], in float b[4]);
2567 float func (inout float a[4], inout float b[4])
2570 return isEqual(a, b) ? 1.0 : -1.0;
2577 float m = func(arr, arr); // returns -1.0
2578 float n = float(test(arr, in0) || test(arr, -in0));
2583 float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
2584 vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
2585 void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
2586 void negate (inout float arr[4]) { set(arr, -get(arr)); }
2587 bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
2588 bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
2592 case copy_global_inout_on_call
2594 desc "Check that global 'in' arguments are copied on call and don't alias."
2597 input vec4 in0 = [ vec4(0.0, 1.0, 2.0, -4.0) | vec4(-7.5, 12.125, -0.25, 16.0) ];
2598 output vec4 out0 = [ vec4(0.0, -1.0, -2.0, 4.0) | vec4(7.5, -12.125, 0.25, -16.0) ];
2603 precision mediump float;
2606 vec4 get (in float arr[4]);
2607 void set (out float arr[4], vec4 val);
2608 void negate (inout float arr[4]);
2609 bool test (in float arr[4], vec4 ref);
2610 bool isEqual (in float a[4], in float b[4]);
2612 float func (in float a[4], in float b[4])
2615 return isEqual(a, b) ? 1.0 : -1.0;
2623 float m = func(arr, arr); // returns -1.0
2624 float n = float(test(arr, in0) || test(arr, -in0));
2629 float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
2630 vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
2631 void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
2632 void negate (inout float arr[4]) { set(arr, -get(arr)); }
2633 bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
2634 bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
2638 # vec4 get (in float arr[4]);
2639 # void set (out float arr[4], vec4 val);
2640 # void negate (inout float arr[4]);
2641 # bool test (in float arr[4], vec4 ref);
2642 # bool isEqual (in float a[4], in float b[4]);
2644 # float absDiff (vec4 a, vec4 b) { vec4 d = abs(a - b); return max(max(d.x, d.y), max(d.z, d.w)); }
2645 # vec4 get (in float arr[4]) { return vec4(arr[0], arr[1], arr[2], arr[3]); }
2646 # void set (out float arr[4], vec4 val) { arr[0] = val.x; arr[1] = val.y; arr[2] = val.z; arr[3] = val.w; }
2647 # void negate (inout float arr[4]) { set(arr, -get(arr)); }
2648 # bool test (in float arr[4], vec4 ref) { return (absDiff(get(arr), ref) < 0.1); }
2649 # bool isEqual (in float a[4], in float b[4]) { return (absDiff(get(a), get(b)) < 0.1); }
2651 end # array_arguments
2653 #group qualifiers "Function Parameter Qualifiers"
2657 group control_flow "Control Flow In Functions"
2663 input float in0 = [ -0.5 | 1.5 ];
2664 output float out0 = [ 0.5 | -1.5 ];
2669 precision mediump float;
2672 float func (float a)
2692 input float in0 = [ -0.5 | 1.5 ];
2693 output float out0 = [ 0.5 | -1.5 ];
2698 precision mediump float;
2701 float func (float a)
2721 input float in0 = [ -0.5 | 1.5 ];
2722 output float out0 = [ 0.5 | -1.5 ];
2727 precision mediump float;
2730 float func (float a)
2752 input float in0 = [ -0.5 | 1.5 ];
2753 output float out0 = [ 0.5 | -1.5 ];
2758 precision mediump float;
2761 float func (float a)
2777 case return_in_loop_if
2781 input float in0 = [ -0.5 | 1.5 ];
2782 output float out0 = [ 0.5 | -1.5 ];
2787 precision mediump float;
2790 float func (float a)
2812 case return_after_loop
2816 input float in0 = [ -0.5 | 1.5 ];
2817 output float out0 = [ 0.5 | -1.5 ];
2822 precision mediump float;
2825 float func (float a)
2827 for (int i = 0; i < 5; i++)
2841 case return_after_break
2845 input float in0 = [ -0.5 | 1.5 ];
2846 output float out0 = [ 0.5 | -1.5 ];
2851 precision mediump float;
2854 float func (float a)
2856 for (int i = 0; i < 6; i++)
2874 case return_after_continue
2878 input float in0 = [ -0.5 | 1.5 ];
2879 output float out0 = [ 0.5 | -1.5 ];
2884 precision mediump float;
2887 float func (float a)
2889 for (int i = 0; i < 6; i++)
2907 case return_in_nested_loop
2911 input float in0 = [ -0.5 | 1.5 ];
2912 output float out0 = [ 0.5 | -1.5 ];
2917 precision mediump float;
2920 float func (float a)
2922 for (int i = 0; i < 6; i++)
2925 for (int j = 0; j < 4; j++)
2946 case return_after_loop_sequence
2950 input float in0 = [ -0.5 | 1.5 ];
2951 output float out0 = [ 0.5 | -1.5 ];
2956 precision mediump float;
2959 float func (float a)
2962 for (i = 0; i < 6; i++) // negate a
2969 for (; i < 10; i++) // keep a
2990 case mixed_return_break_continue
2994 input float in0 = [ -0.5 | 1.5 ];
2995 output float out0 = [ 0.5 | -1.5 ];
3000 precision mediump float;
3003 float func (float a)
3006 for (i = 0; i < 6; i++)
3034 group misc "Miscellaneous"
3036 case multi_arg_float
3040 input vec4 in0 = [ vec4(0.0, 1.0, -2.0, 0.5) | vec4(2.0, 2.5, 4.0, -7.0) ];
3041 output float out0 = [ 0.5 | -1.5 ]; # -sum(in0)
3046 precision mediump float;
3049 float sum(vec4 v) { return (v.x + v.y + v.z + v.w); }
3051 float func (float a, vec3 b, vec2 c, vec2 d, vec4 e)
3053 return -sum(vec4(a, b) + vec4(c, d)) + sum(e);
3059 out0 = func(in0.y, in0.xzw, in0.wz, in0.yx, in0);
3069 input ivec4 in0 = [ ivec4(-1, 0, 2, 2) | ivec4(1, 4, -8, 2) ];
3070 output int out0 = [ -3 | 1 ];
3075 precision mediump float;
3076 precision mediump int;
3079 int sum(ivec4 v) { return (v.x + v.y + v.z + v.w); }
3081 int func (int a, ivec3 b, ivec2 c, ivec2 d, ivec4 e)
3083 return -sum(ivec4(a, b) + ivec4(c, d)) + sum(e);
3089 out0 = func(in0.y, in0.xzw, in0.wz, in0.yx, in0);
3095 case argument_eval_order_1
3099 input int in0 = [ 0 | 1 | 3 | 5 ];
3100 output int out0 = [ -1 | 5 | 11 | 17 ];
3105 precision highp float;
3108 int func (float a, int b, bool c, int d)
3111 return b + int(a) + d;
3119 float v0 = float(in0);
3121 out0 = func((v0 += 1.0), v1++, (v0 > 1.5), v1);
3127 case argument_eval_order_2
3131 input int in0 = [ 0 | -1 | 3 | 5 ];
3132 output int out0 = [ 3 | -1 | 9 | 13 ];
3137 precision highp float;
3148 int func (float a, int b, bool c, int d)
3151 return b + int(a) + d;
3159 out0 = func(float(g = in0), modG(2), --g > 0, g);
3167 group invalid "Invalid Functions"
3173 precision mediump float;
3183 ${POSITION_FRAG_COLOR} = vec4(1.0);
3188 case continue_in_body
3193 precision mediump float;
3203 ${POSITION_FRAG_COLOR} = vec4(1.0);
3208 case return_value_from_void_function
3213 precision mediump float;
3223 ${POSITION_FRAG_COLOR} = vec4(1.0);
3228 case extra_arguments
3233 precision mediump float;
3243 ${POSITION_FRAG_COLOR} = vec4(1.0);
3248 case missing_arguments
3253 precision mediump float;
3263 ${POSITION_FRAG_COLOR} = vec4(1.0);
3268 case missing_argument_type
3273 precision mediump float;
3282 ${POSITION_FRAG_COLOR} = vec4(1.0);
3287 case argument_basetype_mismatch
3292 precision mediump float;
3293 precision mediump int;
3303 ${POSITION_FRAG_COLOR} = vec4(1.0);
3308 case argument_scalar_vector_mismatch
3313 precision mediump float;
3323 ${POSITION_FRAG_COLOR} = vec4(1.0);
3328 case argument_vector_size_mismatch
3333 precision mediump float;
3343 ${POSITION_FRAG_COLOR} = vec4(1.0);
3348 case duplicate_function
3353 precision mediump float;
3368 ${POSITION_FRAG_COLOR} = vec4(1.0);
3373 case prototype_mismatch_return_type
3378 precision mediump float;
3385 ${POSITION_FRAG_COLOR} = vec4(1.0);
3395 case prototype_unspecified_array_size
3400 precision mediump float;
3403 void func (vec3 f[]);
3407 ${POSITION_FRAG_COLOR} = vec4(1.0);
3412 case call_mismatch_argument_array_size
3417 precision mediump float;
3420 void func (vec3 f[3]);
3421 void func (vec3 f[3])
3429 ${POSITION_FRAG_COLOR} = vec4(1.0);
3434 case prototype_mismatch_argument_const
3439 precision mediump float;
3443 void func (const vec3 f)
3449 ${POSITION_FRAG_COLOR} = vec4(1.0);
3454 case prototype_mismatch_argument_array_const
3459 precision mediump float;
3462 void func (vec3 f[3]);
3463 void func (const vec3 f[3])
3469 ${POSITION_FRAG_COLOR} = vec4(1.0);
3474 case prototype_mismatch_array_inout
3479 precision mediump float;
3482 void func (out vec3 f);
3483 void func (inout vec3 f)
3489 ${POSITION_FRAG_COLOR} = vec4(1.0);
3494 case missing_return_type
3499 precision mediump float;
3503 func (inout vec3 f[3])
3509 ${POSITION_FRAG_COLOR} = vec4(1.0);
3514 case call_before_definition
3519 precision mediump float;
3525 ${POSITION_FRAG_COLOR} = vec4(1.0);
3535 case argument_precision_overload
3540 precision mediump float;
3543 float func (lowp float f)
3548 float func (mediump float f)
3555 ${POSITION_FRAG_COLOR} = vec4(1.0);
3560 case argument_in_out_overload
3565 precision mediump float;
3568 void func (in float f)
3572 void func (out float f)
3579 ${POSITION_FRAG_COLOR} = vec4(1.0);
3584 case argument_in_inout_overload
3589 precision mediump float;
3592 void func (in float f)
3596 void func (inout float f)
3603 ${POSITION_FRAG_COLOR} = vec4(1.0);
3608 case argument_out_inout_overload
3613 precision mediump float;
3616 void func (out float f)
3621 void func (inout float f)
3628 ${POSITION_FRAG_COLOR} = vec4(1.0);
3633 case return_type_overload
3638 precision mediump float;
3641 float func (float f)
3653 ${POSITION_FRAG_COLOR} = vec4(1.0);
3658 case return_type_precision_overload
3663 precision mediump float;
3666 lowp float func (float f)
3671 mediump float func (float f)
3678 ${POSITION_FRAG_COLOR} = vec4(1.0);
3683 case return_type_const_overload
3688 precision mediump float;
3691 float func (float f)
3696 const float func (float f)
3703 ${POSITION_FRAG_COLOR} = vec4(1.0);
3708 case return_without_value
3713 precision mediump float;
3716 float func (float f)
3724 ${POSITION_FRAG_COLOR} = vec4(1.0);
3729 case local_function_prototype
3734 precision mediump float;
3739 float func (float f);
3741 ${POSITION_FRAG_COLOR} = vec4(1.0);
3746 case local_function_definition
3751 precision mediump float;
3756 float func (float f)
3761 ${POSITION_FRAG_COLOR} = vec4(1.0);
3766 case name_type_conflict
3771 precision mediump float;
3774 struct foo { float a; }
3783 ${POSITION_FRAG_COLOR} = vec4(1.0);
3793 precision mediump float;
3800 void func (const vec3 f)
3806 ${POSITION_FRAG_COLOR} = vec4(1.0);
3816 precision mediump float;
3826 ${POSITION_FRAG_COLOR} = vec4(1.0);
3836 precision mediump float;
3846 ${POSITION_FRAG_COLOR} = vec4(1.0);
3856 precision mediump float;
3866 ${POSITION_FRAG_COLOR} = vec4(1.0);
3876 precision mediump float;
3886 ${POSITION_FRAG_COLOR} = vec4(1.0);
3891 case uniform_argument
3896 precision mediump float;
3899 void func (uniform vec3 f)
3905 ${POSITION_FRAG_COLOR} = vec4(1.0);
3910 case uniform_return_type
3915 precision mediump float;
3918 uniform float func (vec3 f)
3925 ${POSITION_FRAG_COLOR} = vec4(1.0);
3935 precision mediump float;
3938 in float func (vec3 f)
3945 ${POSITION_FRAG_COLOR} = vec4(func(vec3(1.0)));
3950 case out_return_type
3955 precision mediump float;
3958 out float func (vec3 f)
3965 ${POSITION_FRAG_COLOR} = vec4(func(vec3(1.0)));
3970 case inout_return_type
3975 precision mediump float;
3978 inout float func (vec3 f)
3985 ${POSITION_FRAG_COLOR} = vec4(func(vec3(1.0)));
3990 case main_invalid_return_type
3995 precision mediump float;
4000 ${POSITION_FRAG_COLOR} = vec4(1.0);
4005 case main_has_arguments
4010 precision mediump float;
4015 ${POSITION_FRAG_COLOR} = vec4(1.0);
4020 case main_missing_return_type
4025 precision mediump float;
4030 ${POSITION_FRAG_COLOR} = vec4(1.0);
4035 case write_const_arg
4040 precision mediump float;
4043 float func (const float f)
4050 ${POSITION_FRAG_COLOR} = vec4(1.0);
4055 case write_const_array_arg
4060 precision mediump float;
4063 float func (const float f[3])
4070 ${POSITION_FRAG_COLOR} = vec4(1.0);
4075 case use_const_arg_in_const_expr
4080 precision mediump float;
4083 float func (const int i)
4091 ${POSITION_FRAG_COLOR} = vec4(func(1));
4096 case use_const_arg_as_array_size
4101 precision mediump float;
4104 float func (const int i)
4113 ${POSITION_FRAG_COLOR} = vec4(func(1));
4118 case overload_builtin_function
4123 precision mediump float;
4128 return int(sin(float(x)));
4133 ${POSITION_FRAG_COLOR} = vec4(sin(1));
4138 case redefine_builtin_function
4143 precision mediump float;
4153 ${POSITION_FRAG_COLOR} = vec4(sin(1.0));
4158 case basic_recursion
4163 precision mediump float;
4171 return fib(x-2.0) + fib(x-1.0);
4176 ${POSITION_FRAG_COLOR} = vec4(fib(5.0));
4181 case simple_tail_recursion
4186 precision mediump float;
4199 ${POSITION_FRAG_COLOR} = vec4(rec(5.0));
4204 case dynamic_conditional_recursion
4209 precision mediump float;
4214 float funcA (float x);
4215 float funcB (float x);
4217 float funcA (float x)
4225 float funcB (float x)
4227 return sqrt(funcA(x));
4232 ${POSITION_FRAG_COLOR} = vec4(funcB(ua));
4237 case dynamic_loop_recursion
4242 precision mediump float;
4247 float funcA (float x);
4248 float funcB (float x);
4250 float funcA (float x)
4252 for (float z = 0.0; z < ub+x; z++)
4261 float funcB (float x)
4263 return sqrt(funcA(x));
4268 ${POSITION_FRAG_COLOR} = vec4(funcB(ua));
4273 case dynamic_switch_recursion
4278 precision mediump float;
4281 uniform mediump int ub;
4283 float funcA (float x);
4284 float funcB (float x);
4286 float funcA (float x)
4288 switch (ub + int(x))
4290 case 0: return ua-1.0;
4292 case 2: return funcB(x*2.0);
4293 default: return 0.0;
4297 float funcB (float x)
4299 return sqrt(funcA(x));
4304 ${POSITION_FRAG_COLOR} = vec4(funcB(ua));
4309 case modify_const_arg
4314 precision mediump float;
4315 precision mediump int;
4318 int func (const int a)
4326 ${POSITION_FRAG_COLOR} = vec4(func(3));
4331 case init_const_local_from_const_arg
4336 precision mediump float;
4337 precision mediump int;
4340 int func (const int a)
4348 ${POSITION_FRAG_COLOR} = vec4(func(3));
4353 case array_size_from_const_arg
4358 precision mediump float;
4359 precision mediump int;
4362 int func (const int a)
4371 ${POSITION_FRAG_COLOR} = vec4(func(3));