Fix WGSL code generation for SwitchWithFallthroughAndVarDecls test.
WGSL does not support SkSL-style switches, since it does not allow
for fallthrough. We attempt to cobble together a valid WGSL switch
statement by permitting switches that don't follow through,
rewriting simple fall-through like `case 0: case 1: ...` with
the WGSL-allowed `case 0, 1: ...`, and rewriting complex fall-
through into if-statements.
In the case of simple fall-through followed by complex fall-
through, we were not maintaining the order of the cases properly,
so we could accidentally rewrite
`case 0: case 1: ...; case 2: ...; break;` into something
like `case 1, 2: ...; break; case 0:;` so that case 0 would not
execute anything.
We now detect this case and generate the proper code.
Change-Id: I033918efc675c134e14400be90f7cc0ba6658d97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/743496
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
11 files changed