Fix assignment-into-indexed-swizzles in SPIR-V and Metal.

In SPIR-V, we would previously assert; now we emit roughly the
same code as glslang.

In Metal, we previously emitted valid-looking code that compiled
without issue, but the results were mysteriously incorrect. Rewriting
the swizzle as a constant-array lookup (similar to the SPIR-V code)
seems to solve the issue. The Metal issue is filed with Apple as
FB12055941.

Change-Id: Ib2a62b7b455de8877fcc3595adfff963f9ba0c8b
Bug: skia:14175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/655822
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
14 files changed