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/GrOpsTask.h b/src/gpu/GrOpsTask.h
index fd69509..a1b2ed1 100644
--- a/src/gpu/GrOpsTask.h
+++ b/src/gpu/GrOpsTask.h
@@ -58,14 +58,20 @@
     void onPrepare(GrOpFlushState* flushState) override;
     bool onExecute(GrOpFlushState* flushState) override;
 
-    void addSampledTexture(GrTextureProxy* proxy) {
+    void addSampledTexture(GrSurfaceProxy* proxy) {
+        // This function takes a GrSurfaceProxy because all subsequent uses of the proxy do not
+        // require the specifics of GrTextureProxy, so this avoids a number of unnecessary virtual
+        // asTextureProxy() calls. However, sampling the proxy implicitly requires that the proxy
+        // be a texture. Eventually, when proxies are a unified type with flags, this can just
+        // assert that capability.
+        SkASSERT(proxy->asTextureProxy());
         fSampledProxies.push_back(proxy);
     }
 
     void addOp(std::unique_ptr<GrOp> op, GrTextureResolveManager textureResolveManager,
                const GrCaps& caps) {
         auto addDependency = [ textureResolveManager, &caps, this ] (
-                GrTextureProxy* p, GrMipMapped mipmapped) {
+                GrSurfaceProxy* p, GrMipMapped mipmapped) {
             this->addDependency(p, mipmapped, textureResolveManager, caps);
         };
 
@@ -84,7 +90,7 @@
                    GrAppliedClip&& clip, const DstProxyView& dstProxyView,
                    GrTextureResolveManager textureResolveManager, const GrCaps& caps) {
         auto addDependency = [ textureResolveManager, &caps, this ] (
-                GrTextureProxy* p, GrMipMapped mipmapped) {
+                GrSurfaceProxy* p, GrMipMapped mipmapped) {
             this->addSampledTexture(p);
             this->addDependency(p, mipmapped, textureResolveManager, caps);
         };
@@ -104,7 +110,7 @@
 
     SkDEBUGCODE(void dump(bool printDependencies) const override;)
     SkDEBUGCODE(int numClips() const override { return fNumClips; })
-    SkDEBUGCODE(void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const override;)
+    SkDEBUGCODE(void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override;)
 
 #if GR_TEST_UTILS
     int numOpChains() const { return fOpChains.count(); }
@@ -296,7 +302,7 @@
 
     // TODO: We could look into this being a set if we find we're adding a lot of duplicates that is
     // causing slow downs.
-    SkTArray<GrTextureProxy*, true> fSampledProxies;
+    SkTArray<GrSurfaceProxy*, true> fSampledProxies;
 
     SkRect fTotalBounds = SkRect::MakeEmpty();
     SkIRect fClippedContentBounds = SkIRect::MakeEmpty();