1#version 450
2
3struct S {
4    int a;
5};
6
7uniform ubuf {
8    S s;
9};
10
11uniform sampler2D s2d;
12
13layout(location = 0) in vec4 inv;
14layout(location = 0) out vec4 outv;
15
16vec4 foo(S s)
17{
18    vec4 r = s.a * inv;
19    ++r;
20    if (r.x > 3.0)
21        --r;
22    else
23        r *= 2;
24
25    return r;
26}
27
28void main()
29{
30    outv = foo(s);
31    outv += texture(s2d, vec2(0.5));
32
33    switch (s.a) {
34    case 10:
35        ++outv;
36        break;
37    case 20:
38        outv = 2 * outv;
39        ++outv;
40        break;
41    default:
42        --outv;
43        break;
44    }
45
46    for (int i = 0; i < 10; ++i)
47        outv *= 3.0;
48
49    outv.x < 10.0 ?
50        outv = sin(outv) :
51        outv = cos(outv);
52}