Emit const-variables in WGSL where possible.
It is illegal to emit a `let` variable at global scope in WGSL, so
we now emit `const` variables at global scope, or when the
expression is definitely a compile-time constant.
I wasn't able to successsfully craft a test case where we would
have emitted a scratch-`let` var at global scope in WGSL, since
the legal expressions at SkSL global scope are also quite limited,
and we always attempt to constant-fold expressions at compile time.
However, we will now handle it properly should it occur.
Bug: skia:14082
Change-Id: I1119ddac97704c58bd214851057513cd8ea9567d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/710897
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
6 files changed