Use just GrSurfaceProxy in pipeline management.

Replaces VisitSurfaceProxyFunc with GrOp::VisitProxyFunc since they are
now the same.

Records sampled textures as GrSurfaceProxies, but asserts they are in fact
texturable. Updates all backends to process the pipelines with surface
proxies (which always have had to do a surface->asTexture() virtual call
that is unchanged, this just avoids the unnecessary proxy virtual).

Also updates the GrTextureOp to not call asTextureProxy() anymore, to
take advantage of the relaxed pipeline types.

A number of instances of asTextureProxy() remain. It is still the primary
method of determining if a proxy is texturable, so code paths that branch
on that still use it. Some resource management code still requires mipmap
functionality specific to the GrTextureProxy API, so they still use it.

To keep this CL sane, the GrFP::TextureSampler and all generated FPs have
not been updated to use GrSurfaceProxy, although that will be in a follow
up since it should be technically possible.

Bug: skia:9556
Change-Id: I1e917aff9e70b08915e98ccc17c6b8f3be29c4f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255830
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 906cd99..cb6a6bd 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -68,7 +68,7 @@
     // Because all the texture properties must be consistent between all the dynamic and fixed
     // primProc proxies, we just deal w/ the first set of dynamic proxies or the set of fixed
     // proxies here.
-    const GrTextureProxy* const* primProcProxies = nullptr;
+    const GrSurfaceProxy* const* primProcProxies = nullptr;
     if (fProgramInfo.hasDynamicPrimProcTextures()) {
         primProcProxies = fProgramInfo.dynamicPrimProcTextures(0);
     } else if (fProgramInfo.hasFixedPrimProcTextures()) {
@@ -108,7 +108,7 @@
         SkString name;
         name.printf("TextureSampler_%d", i);
         const auto& sampler = proc.textureSampler(i);
-        SkASSERT(sampler.textureType() == primProcProxies[i]->textureType());
+        SkASSERT(sampler.textureType() == primProcProxies[i]->backendFormat().textureType());
         texSamplers[i] = this->emitSampler(primProcProxies[i],
                                            sampler.samplerState(),
                                            sampler.swizzle(),
@@ -279,7 +279,7 @@
     fFS.codeAppend("}");
 }
 
-GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(const GrTextureProxy* texture,
+GrGLSLProgramBuilder::SamplerHandle GrGLSLProgramBuilder::emitSampler(const GrSurfaceProxy* texture,
                                                                       const GrSamplerState& state,
                                                                       const GrSwizzle& swizzle,
                                                                       const char* name) {
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index a3bcbe1..9a19cc0 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -161,7 +161,7 @@
                                     SkString output,
                                     SkTArray<std::unique_ptr<GrGLSLFragmentProcessor>>*);
     void emitAndInstallXferProc(const SkString& colorIn, const SkString& coverageIn);
-    SamplerHandle emitSampler(const GrTextureProxy*, const GrSamplerState&, const GrSwizzle&,
+    SamplerHandle emitSampler(const GrSurfaceProxy*, const GrSamplerState&, const GrSwizzle&,
                               const char* name);
     bool checkSamplerCounts();
 
diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h
index f27d961..726195b 100644
--- a/src/gpu/glsl/GrGLSLUniformHandler.h
+++ b/src/gpu/glsl/GrGLSLUniformHandler.h
@@ -17,7 +17,7 @@
 
 class GrGLSLProgramBuilder;
 class GrSamplerState;
-class GrTextureProxy;
+class GrSurfaceProxy;
 
 // Handles for program uniforms (other than per-effect uniforms)
 struct GrGLSLBuiltinUniformHandles {
@@ -84,7 +84,7 @@
     // Only called if GrShaderCaps(:textureSwizzleAppliedInShader() == true.
     virtual GrSwizzle samplerSwizzle(SamplerHandle) const = 0;
 
-    virtual SamplerHandle addSampler(const GrTextureProxy*, const GrSamplerState&, const GrSwizzle&,
+    virtual SamplerHandle addSampler(const GrSurfaceProxy*, const GrSamplerState&, const GrSwizzle&,
                                      const char* name, const GrShaderCaps*) = 0;
 
     virtual UniformHandle internalAddUniformArray(uint32_t visibility,