Factor out SPIR-V typecasting helper functions.

The test diffs look scary, but the only actual change is a minor
renumbering of IDs. The actual logic is the same.

Change-Id: I5ecc26c8581a4c01834932ff0291deba7d9e4618
Bug: skia:11171
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353622
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
41 files changed