Debian Codegraph @

third_party/spirv-cross/shaders-msl/comp/cfg-preserve-parameter.comp

raw
1 #version 310 es
2
3 // We write in all paths (and no reads), so should just be out.
4 void out_test_0(int cond, inout int i)
5 {
6 if (cond == 0)
7 i = 40;
8 else
9 i = 60;
10 }
11
12 // We write in all paths (and no reads), so should just be out.
13 void out_test_1(int cond, inout int i)
14 {
15 switch (cond)
16 {
17 case 40:
18 i = 40;
19 break;
20
21 default:
22 i = 70;
23 break;
24 }
25 }
26
27 // We don't write in all paths, so should be inout.
28 void inout_test_0(int cond, inout int i)
29 {
30 if (cond == 0)
31 i = 40;
32 }
33
34 void inout_test_1(int cond, inout int i)
35 {
36 switch (cond)
37 {
38 case 40:
39 i = 40;
40 break;
41 }
42 }
43
44
45 void main()
46 {
47 int cond = 40;
48 int i = 50;
49
50 out_test_0(cond, i);
51 out_test_1(cond, i);
52 inout_test_0(cond, i);
53 inout_test_1(cond, i);
54 }