blob: 20743bb5117a77bd3f6b6ffdff6e9881999c92b8 [file] [log] [blame]
/*#pragma settings RewriteSwitchStatements*/
uniform half4 colorGreen, colorRed;
bool switch_fallthrough(int value) {
bool ok = false;
switch (value) {
case 2: break;
case 1:
case 0: ok = true; break;
default: break;
}
return ok;
}
bool switch_fallthrough_twice(int value) {
bool ok = false;
switch (value) {
case 0: break;
case 1:
case 2:
case 3: ok = true; break;
default: break;
}
return ok;
}
bool switch_fallthrough_groups(int value) {
bool ok = false;
switch (value) {
case -1: ok = false;
case 0: return false;
case 1: ok = true;
case 2:
case 3: break;
case 4: ok = false;
case 5:
case 6:
case 7:
default: break;
}
return ok;
}
half4 main(float2 coords) {
int x = int(colorGreen.g);
return (switch_fallthrough(x) &&
switch_fallthrough_twice(x) &&
switch_fallthrough_groups(x)) ? colorGreen : colorRed;
}