Improve support for sampler2d type in Metal.

Context: http://docs/document/d/1-eHwItBZqTG-qHsmBD3YPzVO0tvfJckyd3xywsmExb0?resourcekey=0-pv43d2jnotRhCLaYoErMMw

Previously, Metal represented sampler2d types as two distinct variables
in Globals. When calling `sample()` it assumed that the name of the
sampler could be derived from the name of the texture by adding a
special suffix.

This actually worked well in most cases, but did not work at all when
passing sampler2d objects as function parameters. In that case we would
only pass the texture and fail to pass the sampler at all. The code
implementing `sample()` would add the special suffix but no such
variable would actually exist.

Now, sampler2d objects in Metal are represented by a struct which
contains the pair of texture2d and sampler objects, and we implement
actual `sample()` polyfill methods which can sample from these
sampler2d objects. Now passing a sampler2d to a function works
normally.

Change-Id: If9b54231213ff783f659fed5ac03e6534843e328
Bug: skia:13558
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/561227
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
10 files changed