Consolidate sampler->index/key conversion

Share code between GL and other backends.

Prepare for separate GrSamplerState field to control mip mapping.

Bug: skia:10344

Change-Id: I16adae3512e11971f98c63ae08fb8cde31332520
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302910
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
7 files changed