1#version 130
2
3uniform bool  u_b;
4uniform bvec2 u_b2;
5uniform bvec3 u_b3;
6uniform bvec4 u_b4;
7
8uniform int   u_i;
9uniform ivec2 u_i2;
10uniform ivec3 u_i3;
11uniform ivec4 u_i4;
12
13uniform float u_f;
14uniform vec2 u_f2;
15uniform vec3 u_f3;
16uniform vec4 u_f4;
17
18uniform bool  i_b;
19uniform bvec2 i_b2;
20uniform bvec3 i_b3;
21uniform bvec4 i_b4;
22
23flat in int   i_i;
24flat in ivec2 i_i2;
25flat in ivec3 i_i3;
26flat in ivec4 i_i4;
27
28in float i_f;
29in vec2 i_f2;
30in vec3 i_f3;
31in vec4 i_f4;
32
33void main()
34{
35    bool   b = bool(u_i) ^^ bool(u_f);
36    bvec2 b2 = bvec2(u_i, u_f);
37    bvec3 b3 = bvec3(u_i, u_f, i_i);
38    bvec4 b4 = bvec4(u_i, u_f, i_i, i_f);
39
40    int    i = int(u_f)    + int(b);
41    ivec2 i2 = ivec2(u_f2) + ivec2(b2);
42    ivec3 i3 = ivec3(u_f3) + ivec3(b3);
43    ivec4 i4 = ivec4(u_f4) + ivec4(b4);
44
45    float f = i;
46    vec2 f2 = i2;
47    vec3 f3 = i3;
48    vec4 f4 = i4;
49
50    f  += (float(i) + float(b));
51    f2 -= vec2(i2) + vec2(b2);
52    f3 /= vec3(i3) + vec3(b3);
53    f4 += vec4(i4) + vec4(b4);
54
55    f4 += vec4(bvec4(i_i4));
56    f4 += vec4(bvec4(u_f4));
57
58    f  += f                 - i;
59    f2 += vec2(f, i)       + i2;
60    f3 += i3 + vec3(f, i, f);
61    f4 += vec4(b, i, f, i) + i4;
62
63    f2 += vec2(f, i)       * i;
64    f3 += vec3(f, i, f)    + i;
65    f4 += i - vec4(b, i, f, i);
66
67    i2 += ivec2(f, i);
68    i3 += ivec3(f, i, f);
69    i4 += ivec4(b, i, f, i);
70
71    if (f < i || i < f ||
72        f2 == i2 ||
73        i3 != f3)
74        f = (b ? i : f2.x) + (b2.x ? f3.x : i2.y);
75
76    gl_FragColor =
77        b ||
78        b2.x ||
79        b2.y ||
80        b3.x ||
81        b3.y ||
82        b3.z ||
83        b4.x ||
84        b4.y ||
85        b4.z ||
86        b4.w ? vec4(
87        i  +
88        i2.x +
89        i2.y +
90        i3.x +
91        i3.y +
92        i3.z +
93        i4.x +
94        i4.y +
95        i4.z +
96        i4.w +
97        f  +
98        f2.x +
99        f2.y +
100        f3.x +
101        f3.y +
102        f3.z +
103        f4.x +
104        f4.y +
105        f4.z +
106        f4.w) : vec4(1.0);
107
108    // with constants...
109    ivec4 cv2 = ivec4(1.0);
110    bvec4 cv5 = bvec4(cv2);
111    gl_FragColor += float(cv5);
112}
113