John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 1 | #version 450 |
2 | |||||
3 | struct S { | ||||
4 | int a; | ||||
5 | }; | ||||
6 | |||||
7 | uniform ubuf { | ||||
8 | S s; | ||||
9 | }; | ||||
10 | |||||
John Kessenich | e485c7a | 2017-05-31 18:50:53 -0600 | [diff] [blame] | 11 | uniform sampler2D s2d; |
12 | |||||
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 13 | layout(location = 0) in vec4 inv; |
14 | layout(location = 0) out vec4 outv; | ||||
15 | |||||
John Kessenich | e485c7a | 2017-05-31 18:50:53 -0600 | [diff] [blame] | 16 | vec4 foo(S s) |
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 17 | { |
John Kessenich | e485c7a | 2017-05-31 18:50:53 -0600 | [diff] [blame] | 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; | ||||
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 26 | } |
27 | |||||
28 | void main() | ||||
29 | { | ||||
John Kessenich | e485c7a | 2017-05-31 18:50:53 -0600 | [diff] [blame] | 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); | ||||
John Kessenich | 121853f | 2017-05-31 17:11:16 -0600 | [diff] [blame] | 52 | } |