Remove GrBackendFormat's textureType use from isFormatTexturable call.

The goal of this change was to remove the use of GrBackendFormat::textureType()
from GrCaps::isFormatTexturable call. Instead we will always pass in a
GrTextureType into this call.

To do this a lot of plumbing of GrTextureType was added to various call
sites. However, this CL halts the plubming up at the proxy level where we
get it from the GrBackendFormat still. Future CLs will continue removing
these call sites and others that use GrBackendFormat::textureType().

Bug: skia:12342
Change-Id: Ic0f02b9c7f7402405623b8aa31aa32a9a7c22297
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439277
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 8eb66f2..a05e84a 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -142,11 +142,21 @@
     sk_sp<GrTexture> tex;
 
     if (SkBackingFit::kApprox == fit) {
-        tex = resourceProvider->createApproxTexture(dimensions, format, renderable,
-                                                    renderTargetSampleCnt, isProtected);
+        tex = resourceProvider->createApproxTexture(dimensions,
+                                                    format,
+                                                    format.textureType(),
+                                                    renderable,
+                                                    renderTargetSampleCnt,
+                                                    isProtected);
     } else {
-        tex = resourceProvider->createTexture(dimensions, format, renderable, renderTargetSampleCnt,
-                                              GrMipmapped::kNo, budgeted, isProtected);
+        tex = resourceProvider->createTexture(dimensions,
+                                              format,
+                                              format.textureType(),
+                                              renderable,
+                                              renderTargetSampleCnt,
+                                              GrMipmapped::kNo,
+                                              budgeted,
+                                              isProtected);
     }
     if (!tex) {
         return nullptr;
@@ -327,8 +337,16 @@
                 GrMipLevel mipLevel = {bitmap.getPixels(), bitmap.rowBytes(), nullptr};
                 auto colorType = SkColorTypeToGrColorType(bitmap.colorType());
                 return LazyCallbackResult(resourceProvider->createTexture(
-                        desc.fDimensions, desc.fFormat, colorType, desc.fRenderable,
-                        desc.fSampleCnt, desc.fBudgeted, desc.fFit, desc.fProtected, mipLevel));
+                        desc.fDimensions,
+                        desc.fFormat,
+                        desc.fFormat.textureType(),
+                        colorType,
+                        desc.fRenderable,
+                        desc.fSampleCnt,
+                        desc.fBudgeted,
+                        desc.fFit,
+                        desc.fProtected,
+                        mipLevel));
             },
             format, dims, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
             GrInternalSurfaceFlags::kNone, fit, budgeted, GrProtected::kNo, UseAllocator::kYes);
@@ -375,8 +393,16 @@
                     SkASSERT(generatedMipLevel.fPixmap.colorType() == bitmap.colorType());
                 }
                 return LazyCallbackResult(resourceProvider->createTexture(
-                        desc.fDimensions, desc.fFormat, colorType, GrRenderable::kNo, 1,
-                        desc.fBudgeted, GrMipMapped::kYes, GrProtected::kNo, texels.get()));
+                        desc.fDimensions,
+                        desc.fFormat,
+                        desc.fFormat.textureType(),
+                        colorType,
+                        GrRenderable::kNo,
+                        1,
+                        desc.fBudgeted,
+                        GrMipMapped::kYes,
+                        GrProtected::kNo,
+                        texels.get()));
             },
             format, dims, GrMipmapped::kYes, GrMipmapStatus::kValid, GrInternalSurfaceFlags::kNone,
             SkBackingFit::kExact, budgeted, GrProtected::kNo, UseAllocator::kYes);
@@ -420,8 +446,12 @@
         }
     }
 
-    if (!caps->validateSurfaceParams(dimensions, format, renderable, renderTargetSampleCnt,
-                                     mipMapped)) {
+    if (!caps->validateSurfaceParams(dimensions,
+                                     format,
+                                     renderable,
+                                     renderTargetSampleCnt,
+                                     mipMapped,
+                                     GrTextureType::k2D)) {
         return nullptr;
     }
     GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipMapped)
@@ -454,7 +484,7 @@
 
     GrBackendFormat format = this->caps()->getBackendFormatFromCompressionType(compressionType);
 
-    if (!this->caps()->isFormatTexturable(format)) {
+    if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
         return nullptr;
     }