blob: cedd60225c568ad635798fe74b417220e0601026 [file] [log] [blame]
John Kessenicha2858d92018-01-31 08:11:18 -07001#version 450
2
3#extension GL_EXT_control_flow_attributes : enable
4
5bool cond;
6
David Neto8c3d5b42019-10-21 14:50:31 -04007void f0() {
8 [[loop]] for (;;) { }
9}
10
11void f1() {
12 [[dont_unroll]] while(true) { }
13}
14
John Kessenicha2858d92018-01-31 08:11:18 -070015void main()
16{
17 [[unroll]] for (int i = 0; i < 8; ++i) { }
David Neto8c3d5b42019-10-21 14:50:31 -040018 f0();
John Kessenicha2858d92018-01-31 08:11:18 -070019 [[dependency_infinite]] do { } while(true);
20 [[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { }
21 [[flatten]] if (cond) { } else { }
22 [[branch]] if (cond) cond = false;
23 [[dont_flatten]] switch(3) { } // dropped
24 [[dont_flatten]] switch(3) { case 3: break; }
25
26 // warnings on all these
27 [[unroll(2)]] for (int i = 0; i < 8; ++i) { }
28 [[dont_unroll(-2)]] while(true) { }
29 [[dependency_infinite(3)]] do { } while(true);
30 [[dependency_length]] for (int i = 0; i < 8; ++i) { }
31 [[flatten(3)]] if (cond) { } else { }
32 [[branch(5.2)]] if (cond) cond = false;
33 [[dont_flatten(3 + 7)]] switch(3) { case 3: break; }
34
35 // other valid uses
36 [[ unroll, dont_unroll, dependency_length(2) ]] while(cond) { }
37 [ [ dont_flatten , branch ] ] switch(3) { case 3: break; }
38 [
39 // attribute
40 [
41 // here
42 flatten
43 ]
44 ] if (cond) { } else { }
45 [[ dependency_length(2), dependency_infinite ]] while(cond) { }
46}