John Kessenich | f6eae2a | 2016-01-22 17:47:22 -0700 | [diff] [blame^] | 1 | #version 140
|
John Kessenich | 39374da | 2015-05-15 21:32:46 +0000 | [diff] [blame] | 2 |
|
| 3 | uniform vec4 bigColor;
|
John Kessenich | f6eae2a | 2016-01-22 17:47:22 -0700 | [diff] [blame^] | 4 | in vec4 BaseColor;
|
John Kessenich | 39374da | 2015-05-15 21:32:46 +0000 | [diff] [blame] | 5 | uniform float d;
|
| 6 |
|
| 7 | float h = 0.0;
|
| 8 |
|
| 9 | float foo(vec4 bar)
|
| 10 | {
|
| 11 | return bar.x + bar.y;
|
| 12 | }
|
| 13 |
|
| 14 | void bar()
|
| 15 | {
|
| 16 | }
|
| 17 |
|
| 18 | float unreachableReturn()
|
| 19 | {
|
| 20 | if (d < 4.2)
|
| 21 | return 1.2;
|
| 22 | else
|
| 23 | return 4.5;
|
| 24 | // might be another return inserted here by builders, has to be correct type
|
| 25 | }
|
| 26 |
|
| 27 | float missingReturn()
|
| 28 | {
|
| 29 | if (d < 4.5) {
|
| 30 | h = d;
|
| 31 | return 3.9;
|
| 32 | }
|
| 33 | }
|
| 34 |
|
| 35 | void main()
|
| 36 | {
|
| 37 | vec4 color = vec4(foo(BaseColor));
|
| 38 |
|
| 39 | bar();
|
| 40 | float f = unreachableReturn();
|
| 41 | float g = missingReturn();
|
| 42 |
|
| 43 | gl_FragColor = color * f * h;
|
| 44 | }
|