blob: 3b6cd27fead7be0d65f1758e3025a19103e5ed81 [file] [log] [blame]
John Kessenich121853f2017-05-31 17:11:16 -06001#version 450
2
3struct S {
4 int a;
5};
6
7uniform ubuf {
8 S s;
9};
10
John Kesseniche485c7a2017-05-31 18:50:53 -060011uniform sampler2D s2d;
12
John Kessenich121853f2017-05-31 17:11:16 -060013layout(location = 0) in vec4 inv;
14layout(location = 0) out vec4 outv;
15
John Kesseniche485c7a2017-05-31 18:50:53 -060016vec4 foo(S s)
John Kessenich121853f2017-05-31 17:11:16 -060017{
John Kesseniche485c7a2017-05-31 18:50:53 -060018 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 Kessenich121853f2017-05-31 17:11:16 -060026}
27
28void main()
29{
John Kesseniche485c7a2017-05-31 18:50:53 -060030 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 Kessenich121853f2017-05-31 17:11:16 -060052}