Migrate switch top-level variables into a block.
This fixes an issue with our GLSL ES2 switch-statement rewrite.
The rewritten form puts braces around each switch-case, which
would artificially limit the lifetime of the inner variables.
By hoisting them outside of the switch, we effectively dodge
this issue. We are likely to need similar rewrites for WGSL, and
it is a harmless transformation, so we apply it unilaterally in
the front-end.
Bug: skia:14375
Change-Id: I50186fb2fa5b09b0b20e7c0cc57b5a90c2383d48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/709959
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
14 files changed