Plumb GrBackendFormat into the GrPrimitiveProcessor::TextureSampler

This is not a substantive CL. It is just setting up for removing the
usage of the GrGpu in the creation of the GrProgramDesc.

Change-Id: Ic24204de256862e5e780626bde3a44f4d735c6e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249121
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index adcfe8c..d63c7d6 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -96,12 +96,11 @@
               GrSamplerState::Filter filter, bool wideColor)
             : INHERITED(kLatticeGP_ClassID), fColorSpaceXform(std::move(csxf)) {
 
-        GrSamplerState samplerState = GrSamplerState(GrSamplerState::WrapMode::kClamp,
-                                                     filter);
+        GrSamplerState samplerState = GrSamplerState(GrSamplerState::WrapMode::kClamp, filter);
         uint32_t extraSamplerKey = gpu->getExtraSamplerKeyForProgram(samplerState,
                                                                      proxy->backendFormat());
 
-        fSampler.reset(proxy->textureType(), samplerState, proxy->textureSwizzle(),
+        fSampler.reset(samplerState, proxy->backendFormat(), proxy->textureSwizzle(),
                        extraSamplerKey);
         this->setTextureSamplerCnt(1);
         fInPosition = {"position", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.cpp b/src/gpu/ops/GrQuadPerEdgeAA.cpp
index 27bd00e..929824c 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.cpp
+++ b/src/gpu/ops/GrQuadPerEdgeAA.cpp
@@ -732,13 +732,13 @@
     }
 
     static sk_sp<GrGeometryProcessor> Make(const VertexSpec& vertexSpec, const GrShaderCaps& caps,
-                                           GrTextureType textureType,
+                                           const GrBackendFormat& backendFormat,
                                            const GrSamplerState& samplerState,
                                            const GrSwizzle& swizzle, uint32_t extraSamplerKey,
                                            sk_sp<GrColorSpaceXform> textureColorSpaceXform,
                                            Saturate saturate) {
         return sk_sp<QuadPerEdgeAAGeometryProcessor>(new QuadPerEdgeAAGeometryProcessor(
-                vertexSpec, caps, textureType, samplerState, swizzle, extraSamplerKey,
+                vertexSpec, caps, backendFormat, samplerState, swizzle, extraSamplerKey,
                 std::move(textureColorSpaceXform), saturate));
     }
 
@@ -939,7 +939,7 @@
 
     QuadPerEdgeAAGeometryProcessor(const VertexSpec& spec,
                                    const GrShaderCaps& caps,
-                                   GrTextureType textureType,
+                                   const GrBackendFormat& backendFormat,
                                    const GrSamplerState& samplerState,
                                    const GrSwizzle& swizzle,
                                    uint32_t extraSamplerKey,
@@ -948,7 +948,7 @@
             : INHERITED(kQuadPerEdgeAAGeometryProcessor_ClassID)
             , fSaturate(saturate)
             , fTextureColorSpaceXform(std::move(textureColorSpaceXform))
-            , fSampler(textureType, samplerState, swizzle, extraSamplerKey) {
+            , fSampler(samplerState, backendFormat, swizzle, extraSamplerKey) {
         SkASSERT(spec.hasLocalCoords());
         this->initializeAttrs(spec);
         this->setTextureSamplerCnt(1);
@@ -1029,12 +1029,12 @@
 }
 
 sk_sp<GrGeometryProcessor> MakeTexturedProcessor(const VertexSpec& spec, const GrShaderCaps& caps,
-                                                 GrTextureType textureType,
+                                                 const GrBackendFormat& backendFormat,
                                                  const GrSamplerState& samplerState,
                                                  const GrSwizzle& swizzle, uint32_t extraSamplerKey,
                                                  sk_sp<GrColorSpaceXform> textureColorSpaceXform,
                                                  Saturate saturate) {
-    return QuadPerEdgeAAGeometryProcessor::Make(spec, caps, textureType, samplerState, swizzle,
+    return QuadPerEdgeAAGeometryProcessor::Make(spec, caps, backendFormat, samplerState, swizzle,
                                                 extraSamplerKey, std::move(textureColorSpaceXform),
                                                 saturate);
 }
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.h b/src/gpu/ops/GrQuadPerEdgeAA.h
index 06bb315..eec30b3 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.h
+++ b/src/gpu/ops/GrQuadPerEdgeAA.h
@@ -89,7 +89,7 @@
     sk_sp<GrGeometryProcessor> MakeProcessor(const VertexSpec& spec);
 
     sk_sp<GrGeometryProcessor> MakeTexturedProcessor(
-            const VertexSpec& spec, const GrShaderCaps& caps, GrTextureType textureType,
+            const VertexSpec& spec, const GrShaderCaps& caps, const GrBackendFormat&,
             const GrSamplerState& samplerState, const GrSwizzle& swizzle, uint32_t extraSamplerKey,
             sk_sp<GrColorSpaceXform> textureColorSpaceXform, Saturate saturate);
 
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index bd4673e..9da40bd 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -572,7 +572,7 @@
         sk_sp<GrGeometryProcessor> gp;
 
         {
-            auto textureType = fProxies[0].fProxy->textureType();
+            const GrBackendFormat& backendFormat = fProxies[0].fProxy->backendFormat();
             const GrSwizzle& swizzle = fProxies[0].fProxy->textureSwizzle();
 
             GrSamplerState samplerState = GrSamplerState(GrSamplerState::WrapMode::kClamp,
@@ -581,11 +581,11 @@
             auto saturate = static_cast<GrTextureOp::Saturate>(fSaturate);
 
             GrGpu* gpu = target->resourceProvider()->priv().gpu();
-            uint32_t extraSamplerKey = gpu->getExtraSamplerKeyForProgram(
-                    samplerState, fProxies[0].fProxy->backendFormat());
+            uint32_t extraSamplerKey = gpu->getExtraSamplerKeyForProgram(samplerState,
+                                                                         backendFormat);
 
             gp = GrQuadPerEdgeAA::MakeTexturedProcessor(
-                vertexSpec, *target->caps().shaderCaps(), textureType, samplerState, swizzle,
+                vertexSpec, *target->caps().shaderCaps(), backendFormat, samplerState, swizzle,
                 extraSamplerKey, std::move(fTextureColorSpaceXform), saturate);
 
             SkASSERT(vertexSize == gp->vertexStride());