Restore support for Metal 1.x when setting up globals.

The code which assembles the globals struct has been factored out to use
a visitor pattern. It is used with two different visitor classes--one
is responsible for building the struct, and another is responsible for
populating the struct. This will ensure that the struct setup and its
initialization are always in 100% lock-step.

Variables that have no default value are initialized via {} which
appears to work exactly like C++, "default value for type."

Unit tests for this code have been added at followup CL
http://review.skia.org/300616

Change-Id: I412df54e2e6b862eb8e9f458d3ffc42158edeee3
Bug: skia:10382
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300256
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2 files changed