Fix WGSL code generation of matrix-div-scalar.
WGSL supports componentwise matrix-plus-matrix and matrix-
minus-matrix, so we would previously rewrite matrix-op-scalar
math as matrix-op-matrix (splatting the scalar across every
matrix element). Unfortunately, WGSL doesn't support
componentwise matrix-div-matrix, so in the case of division,
splatting the scalar into a matrix didn't actually work as a
viable polyfill.
We now rewrite _all_ cases of addition/subtraction/division
matrix-op-scalar as repeated vector-op-scalar. WGSL does offer
vector-op-scalar which works with division, addition and
subtraction, and as you would hope, this performs componentwise
arithmetic on each vector element. This fixes the
MatrixScalarNoOpFolding test, and also changes various existing
test output.
Change-Id: Iec6f0be49c614552dddcc2a26b269256f4c699f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/743262
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
8 files changed