Improve matrix construction abilities in Metal codegen.

GLSL (and thus SkSL) is flexible about the input parameters to a matrix
constructor. You can mix vectors and scalars freely, and it will
populate them into your matrix as if it was a flat list of scalars.

Metal does not natively support this, and requires the proper number of
floatNs to be passed in. However, the Metal code generator will now emit
constructor helper functions that will fix this up automatically.

Additionally, this CL simplifies the Metal codegen for single-scalar
matrix construction. This should create a matrix with the passed-in
scalar running along the matrix diagonal. The Metal codegen previously
emitted a helper function to do this work on our behalf. However,
that's not necessary; Metal already contains a single-argument matrix
constructor that will do this work automatically for us.

Change-Id: I76901bfe167502797aa4cb98d0e8986d9ebc51e5
Bug: skia:10280
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292477
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
3 files changed