• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*#pragma settings NoInline*/
2
3uniform half4 colorGreen, colorRed;
4
5half4 dead_fn(half4 a, half4 b) {
6    return a * b;
7}
8
9half4 live_fn(half4 a, half4 b) {
10    return a + b;
11}
12
13half4 main(float2 coords) {
14    const bool TRUE = true, FALSE = false;
15    half4 a, b;
16
17    @if (FALSE) {
18        // Dead stripping a user function.
19        half4 unused = dead_fn(half4(0.5), half4(2));
20    } else {
21        // A live user function.
22        a = live_fn(half4(3), half4(-5));
23    }
24
25    @if (TRUE) {
26        // A live built-in function.
27        b = unpremul(half4(1));
28    } else {
29        // Dead stripping a built-in function. (This is a separate overload of `unpremul`.)
30        float4 unused = unpremul(float4(-1));
31    }
32
33    return (a != half4(0) && b != half4(0)) ? colorGreen : colorRed;
34}
35