skia2/resources/sksl/dslfp/GrDSLFPTest_SwitchStatement.fp
John Stiles 7c59ab868d Honor static statements in DSL C++ codegen.
Change-Id: I06631e7f0db518f4de19a39bf1ed368afbd5d409
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403076
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-30 18:40:08 +00:00

29 lines
688 B
GLSL

layout(key) in int ten; // always equals 10
half4 main() {
int4 color = int4(0);
switch (color.r) { // will take case 0
case 0: ++color.g; // fallthrough
case 1: break;
case 2: return half4(0);
case 3: // fallthrough
case 4: ++color.r; // fallthrough
case 5: { ++color.b; } break;
default: { --color.g; break; }
}
switch (color.g) { // will take case 1
case 1: break;
case 0: { color.r = 1; color.b = 1; }
}
@switch (ten) {
case 0: color.r = color.g; break;
case 20: color.b = color.g; break;
case 10: color.a = color.g; break;
}
return half4(color);
}