2020-11-26 03:19:16 +00:00
|
|
|
/*#pragma settings NoInline*/
|
|
|
|
|
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-02-01 16:52:10 +00:00
|
|
|
half4 main() {
|
|
|
|
bool TRUE = true, FALSE = false;
|
|
|
|
half4 a, b;
|
2020-11-26 03:19:16 +00:00
|
|
|
|
2021-02-01 16:52:10 +00:00
|
|
|
if (FALSE) {
|
|
|
|
// 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-02-01 16:52:10 +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 {
|
|
|
|
// Dead stripping a built-in function.
|
|
|
|
float4 unused = unpremul_float(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
|
|
|
}
|