1/*#pragma settings RewriteSwitchStatements*/ 2 3uniform half4 colorGreen, colorRed; 4 5half4 main(float2 coords) { 6 bool ok; 7 8 switch (int(colorGreen.g)) { 9 case 0: bool a; // `a` should be declared above the switch. 10 case 1: const int ONE = 1; // a const-declaration can also move above the switch safely. 11 case 2: int b = ONE, c; // declarations for `b` and `c` should be moved upwards; 12 // an assignment-statement `b = ONE` should be here instead. 13 case 3: { float d = float(b); c = int(d); } // no changes expected 14 case 4: a = bool(c); // " " " 15 case 5: ok = a; // " " " 16 } 17 18 return ok ? colorGreen : colorRed; 19} 20