2021-03-11 04:00:47 +00:00
|
|
|
/*#pragma settings NoInline*/
|
2020-11-26 03:19:16 +00:00
|
|
|
|
2021-02-01 16:52:10 +00:00
|
|
|
uniform half4 colorGreen, colorRed;
|
|
|
|
|
2020-11-26 03:19:16 +00:00
|
|
|
half4 dead_fn(half4 a, half4 b) {
|
|
|
|
return a * b;
|
|
|
|
}
|
|
|
|
|
|
|
|
half4 live_fn(half4 a, half4 b) {
|
|
|
|
return a + b;
|
|
|
|
}
|
|
|
|
|
2021-04-21 18:27:08 +00:00
|
|
|
half4 main(float2 coords) {
|
2021-03-03 21:13:45 +00:00
|
|
|
const bool TRUE = true, FALSE = false;
|
2021-02-01 16:52:10 +00:00
|
|
|
half4 a, b;
|
2020-11-26 03:19:16 +00:00
|
|
|
|
2021-03-03 21:13:45 +00:00
|
|
|
@if (FALSE) {
|
2021-02-01 16:52:10 +00:00
|
|
|
// Dead stripping a user function.
|
|
|
|
half4 unused = dead_fn(half4(0.5), half4(2));
|
|
|
|
} else {
|
2020-11-26 03:19:16 +00:00
|
|
|
// A live user function.
|
2021-02-01 16:52:10 +00:00
|
|
|
a = live_fn(half4(3), half4(-5));
|
2020-11-26 03:19:16 +00:00
|
|
|
}
|
|
|
|
|
2021-03-03 21:13:45 +00:00
|
|
|
@if (TRUE) {
|
2020-11-26 03:19:16 +00:00
|
|
|
// A live built-in function.
|
2021-02-01 16:52:10 +00:00
|
|
|
b = unpremul(half4(1));
|
|
|
|
} else {
|
2021-03-22 16:24:28 +00:00
|
|
|
// Dead stripping a built-in function. (This is a separate overload of `unpremul`.)
|
|
|
|
float4 unused = unpremul(float4(-1));
|
2020-11-26 03:19:16 +00:00
|
|
|
}
|
2021-02-01 16:52:10 +00:00
|
|
|
|
|
|
|
return (a != half4(0) && b != half4(0)) ? colorGreen : colorRed;
|
2020-11-26 03:19:16 +00:00
|
|
|
}
|