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/GrCopyRenderTask.h b/src/gpu/GrCopyRenderTask.h
index c4f839c..7577ffc 100644
--- a/src/gpu/GrCopyRenderTask.h
+++ b/src/gpu/GrCopyRenderTask.h
@@ -40,7 +40,7 @@
     bool onExecute(GrOpFlushState*) override;
 
 #ifdef SK_DEBUG
-    void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override {
+    void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {
         fn(fSrcView.proxy(), GrMipMapped::kNo);
     }
 #endif
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 9bf6e7d..377181d 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -342,7 +342,7 @@
             GrRenderTarget* renderTarget, GrSurfaceOrigin, const SkIRect& bounds,
             const GrOpsRenderPass::LoadAndStoreInfo&,
             const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) = 0;
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) = 0;
 
     // Called by GrDrawingManager when flushing.
     // Provides a hook for post-flush actions (e.g. Vulkan command buffer submits). This will also
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 6a3fde9..b934097 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -102,11 +102,11 @@
         return *fOpArgs;
     }
 
-    void setSampledProxyArray(SkTArray<GrTextureProxy*, true>* sampledProxies) {
+    void setSampledProxyArray(SkTArray<GrSurfaceProxy*, true>* sampledProxies) {
         fSampledProxies = sampledProxies;
     }
 
-    SkTArray<GrTextureProxy*, true>* sampledProxyArray() override {
+    SkTArray<GrSurfaceProxy*, true>* sampledProxyArray() override {
         return fSampledProxies;
     }
 
@@ -199,7 +199,7 @@
 
     // This field is only transiently set during flush. Each GrOpsTask will set it to point to an
     // array of proxies it uses before call onPrepare and onExecute.
-    SkTArray<GrTextureProxy*, true>* fSampledProxies;
+    SkTArray<GrSurfaceProxy*, true>* fSampledProxies;
 
     GrGpu* fGpu;
     GrResourceProvider* fResourceProvider;
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 97651d2..b57066f 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -460,7 +460,7 @@
 static GrOpsRenderPass* create_render_pass(
         GrGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
         GrLoadOp colorLoadOp, const SkPMColor4f& loadClearColor, GrLoadOp stencilLoadOp,
-        GrStoreOp stencilStoreOp, const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+        GrStoreOp stencilStoreOp, const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     const GrOpsRenderPass::LoadAndStoreInfo kColorLoadStoreInfo {
         colorLoadOp,
         GrStoreOp::kStore,
@@ -690,8 +690,8 @@
     }
 }
 
-void GrOpsTask::visitProxies_debugOnly(const VisitSurfaceProxyFunc& func) const {
-    auto textureFunc = [ func ] (GrTextureProxy* tex, GrMipMapped mipmapped) {
+void GrOpsTask::visitProxies_debugOnly(const GrOp::VisitProxyFunc& func) const {
+    auto textureFunc = [ func ] (GrSurfaceProxy* tex, GrMipMapped mipmapped) {
         func(tex, mipmapped);
     };
 
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();
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 537293bb..fc41dfa 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -76,7 +76,7 @@
         SkIRect fScissorRect = SkIRect::EmptyIRect();
         // Must have GrPrimitiveProcessor::numTextureSamplers() entries. Can be null if no samplers
         // or textures are passed using DynamicStateArrays.
-        GrTextureProxy** fPrimitiveProcessorTextures = nullptr;
+        GrSurfaceProxy** fPrimitiveProcessorTextures = nullptr;
     };
 
     /**
@@ -88,7 +88,7 @@
         // Must have GrPrimitiveProcessor::numTextureSamplers() * num_meshes entries.
         // Can be null if no samplers or to use the same textures for all meshes via'
         // FixedDynamicState.
-        GrTextureProxy** fPrimitiveProcessorTextures = nullptr;
+        GrSurfaceProxy** fPrimitiveProcessorTextures = nullptr;
     };
 
     /**
diff --git a/src/gpu/GrProgramInfo.cpp b/src/gpu/GrProgramInfo.cpp
index 7b97af4..e61fff0 100644
--- a/src/gpu/GrProgramInfo.cpp
+++ b/src/gpu/GrProgramInfo.cpp
@@ -49,15 +49,16 @@
             auto dynamicPrimProcTextures = this->dynamicPrimProcTextures(0);
 
             const GrBackendFormat& format = dynamicPrimProcTextures[s]->backendFormat();
-            GrTextureType type = dynamicPrimProcTextures[s]->textureType();
+            GrTextureType type = dynamicPrimProcTextures[s]->backendFormat().textureType();
             GrPixelConfig config = dynamicPrimProcTextures[s]->config();
 
             for (int m = 1; m < fNumDynamicStateArrays; ++m) {
                 dynamicPrimProcTextures = this->dynamicPrimProcTextures(m);
 
                 auto testProxy = dynamicPrimProcTextures[s];
+                SkASSERT(testProxy->asTextureProxy());
                 SkASSERT(testProxy->backendFormat() == format);
-                SkASSERT(testProxy->textureType() == type);
+                SkASSERT(testProxy->backendFormat().textureType() == type);
                 SkASSERT(testProxy->config() == config);
             }
         }
diff --git a/src/gpu/GrProgramInfo.h b/src/gpu/GrProgramInfo.h
index 4567bd2..a5ce0da 100644
--- a/src/gpu/GrProgramInfo.h
+++ b/src/gpu/GrProgramInfo.h
@@ -78,7 +78,7 @@
         return fDynamicStateArrays && fDynamicStateArrays->fPrimitiveProcessorTextures;
     }
 
-    const GrTextureProxy* const* dynamicPrimProcTextures(int i) const {
+    const GrSurfaceProxy* const* dynamicPrimProcTextures(int i) const {
         SkASSERT(this->hasDynamicPrimProcTextures());
         SkASSERT(i < fNumDynamicStateArrays);
 
@@ -90,7 +90,7 @@
         return fFixedDynamicState && fFixedDynamicState->fPrimitiveProcessorTextures;
     }
 
-    const GrTextureProxy* const* fixedPrimProcTextures() const {
+    const GrSurfaceProxy* const* fixedPrimProcTextures() const {
         SkASSERT(this->hasFixedPrimProcTextures());
 
         return fFixedDynamicState->fPrimitiveProcessorTextures;
diff --git a/src/gpu/GrRenderTask.h b/src/gpu/GrRenderTask.h
index efa1305..15e5ffd 100644
--- a/src/gpu/GrRenderTask.h
+++ b/src/gpu/GrRenderTask.h
@@ -76,11 +76,9 @@
 
     virtual int numClips() const { return 0; }
 
-    using VisitSurfaceProxyFunc = std::function<void(GrSurfaceProxy*, GrMipMapped)>;
+    virtual void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const = 0;
 
-    virtual void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const = 0;
-
-    void visitTargetAndSrcProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const {
+    void visitTargetAndSrcProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const {
         this->visitProxies_debugOnly(fn);
         if (fTargetView.proxy()) {
             fn(fTargetView.proxy(), GrMipMapped::kNo);
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 1cc1178..eb5b8bb 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -147,10 +147,11 @@
                                   this->proxyMipMapped(), !this->priv().isExact());
 }
 
-bool GrTextureProxy::ProxiesAreCompatibleAsDynamicState(const GrTextureProxy* first,
-                                                        const GrTextureProxy* second) {
+bool GrTextureProxy::ProxiesAreCompatibleAsDynamicState(const GrSurfaceProxy* first,
+                                                        const GrSurfaceProxy* second) {
+    // In order to be compatible, the proxies should also have the same texture type, but since
+    // that is owned by the backend format, the formats being equal is sufficient.
     return first->config() == second->config() &&
-           first->textureType() == second->textureType() &&
            first->backendFormat() == second->backendFormat();
 }
 
diff --git a/src/gpu/GrTextureProxy.h b/src/gpu/GrTextureProxy.h
index d592265..8461016 100644
--- a/src/gpu/GrTextureProxy.h
+++ b/src/gpu/GrTextureProxy.h
@@ -61,9 +61,11 @@
     }
 
     // Returns true if the passed in proxies can be used as dynamic state together when flushing
-    // draws to the gpu.
-    static bool ProxiesAreCompatibleAsDynamicState(const GrTextureProxy* first,
-                                                   const GrTextureProxy* second);
+    // draws to the gpu. This accepts GrSurfaceProxy since the information needed is defined on
+    // that type, but this function exists in GrTextureProxy because it's only relevant when the
+    // proxies are being used as textures.
+    static bool ProxiesAreCompatibleAsDynamicState(const GrSurfaceProxy* first,
+                                                   const GrSurfaceProxy* second);
 
     /**
      * Return the texture proxy's unique key. It will be invalid if the proxy doesn't have one.
diff --git a/src/gpu/GrTextureResolveRenderTask.cpp b/src/gpu/GrTextureResolveRenderTask.cpp
index 8c326d3..80ef7e9 100644
--- a/src/gpu/GrTextureResolveRenderTask.cpp
+++ b/src/gpu/GrTextureResolveRenderTask.cpp
@@ -93,7 +93,7 @@
 }
 
 #ifdef SK_DEBUG
-void GrTextureResolveRenderTask::visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const {
+void GrTextureResolveRenderTask::visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const {
     for (const auto& resolve : fResolves) {
         fn(resolve.fProxyView.proxy(), GrMipMapped::kNo);
     }
diff --git a/src/gpu/GrTextureResolveRenderTask.h b/src/gpu/GrTextureResolveRenderTask.h
index 1a3aed0..9d567d3 100644
--- a/src/gpu/GrTextureResolveRenderTask.h
+++ b/src/gpu/GrTextureResolveRenderTask.h
@@ -35,7 +35,7 @@
     bool onExecute(GrOpFlushState*) override;
 
 #ifdef SK_DEBUG
-    SkDEBUGCODE(void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const override;)
+    SkDEBUGCODE(void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override;)
 #endif
 
     struct Resolve {
diff --git a/src/gpu/GrTransferFromRenderTask.h b/src/gpu/GrTransferFromRenderTask.h
index d8f6c12..ce29b97 100644
--- a/src/gpu/GrTransferFromRenderTask.h
+++ b/src/gpu/GrTransferFromRenderTask.h
@@ -42,7 +42,7 @@
     bool onExecute(GrOpFlushState*) override;
 
 #ifdef SK_DEBUG
-    void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override {
+    void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {
         fn(fSrcProxy.get(), GrMipMapped::kNo);
     }
 #endif
diff --git a/src/gpu/GrWaitRenderTask.h b/src/gpu/GrWaitRenderTask.h
index bc6ddc3..f93aade 100644
--- a/src/gpu/GrWaitRenderTask.h
+++ b/src/gpu/GrWaitRenderTask.h
@@ -37,7 +37,7 @@
 
 #ifdef SK_DEBUG
     // No non-dst proxies.
-    void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override {}
+    void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {}
 #endif
     std::unique_ptr<std::unique_ptr<GrSemaphore>[]> fSemaphores;
     int fNumSemaphores;
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index ce5c49b..dae8a47 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -566,8 +566,8 @@
 
         if (n > 0 &&
             (!GrTextureProxy::ProxiesAreCompatibleAsDynamicState(
-                    textures[i].fProxyView.asTextureProxy(),
-                    textures[base].fProxyView.asTextureProxy()) ||
+                    textures[i].fProxyView.proxy(),
+                    textures[base].fProxyView.proxy()) ||
              set[i].fImage->alphaType() != set[base].fImage->alphaType() ||
              !SkColorSpace::Equals(set[i].fImage->colorSpace(), set[base].fImage->colorSpace()))) {
             draw();
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 0d14575..c4f7472 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -448,13 +448,12 @@
     for (const InstanceRange& range : fInstanceRanges) {
         SkASSERT(range.fEndInstanceIdx > baseInstance);
 
-        const GrTextureProxy* atlas = range.fAtlasProxy;
+        GrSurfaceProxy* atlas = range.fAtlasProxy;
         if (atlas->isInstantiated()) {  // Instantiation can fail in exceptional circumstances.
             GrCCPathProcessor pathProc(range.fCoverageMode, atlas->peekTexture(),
                                        atlas->textureSwizzle(), atlas->origin(),
                                        fViewMatrixIfUsingLocalCoords);
-            GrTextureProxy* atlasProxy = range.fAtlasProxy;
-            fixedDynamicState.fPrimitiveProcessorTextures = &atlasProxy;
+            fixedDynamicState.fPrimitiveProcessorTextures = &atlas;
             pathProc.drawPaths(flushState, pipeline, &fixedDynamicState, *resources, baseInstance,
                                range.fEndInstanceIdx, this->bounds());
         }
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp
index 4174dba..ae9e6d4 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.cpp
+++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp
@@ -81,7 +81,7 @@
 
     void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
         SkASSERT(fSrcProxy);
-        auto srcProxy = fSrcProxy.get();
+        GrSurfaceProxy* srcProxy = fSrcProxy.get();
         SkASSERT(srcProxy->isInstantiated());
 
         auto coverageMode = GrCCPathProcessor::GetCoverageMode(
diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp
index fbb3404..009b450 100644
--- a/src/gpu/dawn/GrDawnGpu.cpp
+++ b/src/gpu/dawn/GrDawnGpu.cpp
@@ -143,7 +143,7 @@
             GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
             const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
             const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     fOpsRenderPass.reset(new GrDawnOpsRenderPass(this, rt, origin, colorInfo, stencilInfo));
     return fOpsRenderPass.get();
 }
diff --git a/src/gpu/dawn/GrDawnGpu.h b/src/gpu/dawn/GrDawnGpu.h
index fb47209..bd485c9 100644
--- a/src/gpu/dawn/GrDawnGpu.h
+++ b/src/gpu/dawn/GrDawnGpu.h
@@ -64,7 +64,7 @@
             GrRenderTarget*, GrSurfaceOrigin, const SkIRect& bounds,
             const GrOpsRenderPass::LoadAndStoreInfo&,
             const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) override;
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) override;
 
     SkSL::Compiler* shaderCompiler() const {
         return fCompiler.get();
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.cpp b/src/gpu/dawn/GrDawnProgramBuilder.cpp
index c493d72..8ac8fbd 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.cpp
+++ b/src/gpu/dawn/GrDawnProgramBuilder.cpp
@@ -541,13 +541,14 @@
 
 wgpu::BindGroup GrDawnProgram::setTextures(GrDawnGpu* gpu,
                                            const GrProgramInfo& programInfo,
-                                           const GrTextureProxy* const primProcTextures[]) {
+                                           const GrSurfaceProxy* const primProcTextures[]) {
     std::vector<wgpu::BindGroupBinding> bindings;
     int binding = 0;
     const GrPipeline& pipeline = programInfo.pipeline();
     const GrPrimitiveProcessor& primProc = programInfo.primProc();
     if (primProcTextures) {
         for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
+            SkASSERT(primProcTextures[i]->asTextureProxy());
             auto& sampler = primProc.textureSampler(i);
             set_texture(gpu, sampler.samplerState(), primProcTextures[i]->peekTexture(), &bindings,
                         &binding);
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.h b/src/gpu/dawn/GrDawnProgramBuilder.h
index 2601bcf..b0758a3 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.h
+++ b/src/gpu/dawn/GrDawnProgramBuilder.h
@@ -67,7 +67,7 @@
     wgpu::BindGroup setUniformData(GrDawnGpu*, const GrRenderTarget*, const GrProgramInfo&);
     wgpu::BindGroup setTextures(GrDawnGpu* gpu,
                                 const GrProgramInfo& programInfo,
-                                const GrTextureProxy* const primProcTextures[]);
+                                const GrSurfaceProxy* const primProcTextures[]);
 };
 
 class GrDawnProgramBuilder : public GrGLSLProgramBuilder {
diff --git a/src/gpu/dawn/GrDawnUniformHandler.cpp b/src/gpu/dawn/GrDawnUniformHandler.cpp
index 6ad8f8c..e8506ae 100644
--- a/src/gpu/dawn/GrDawnUniformHandler.cpp
+++ b/src/gpu/dawn/GrDawnUniformHandler.cpp
@@ -231,7 +231,7 @@
     fUniforms[u.toIndex()].fVisibility |= visibility;
 }
 
-GrGLSLUniformHandler::SamplerHandle GrDawnUniformHandler::addSampler(const GrTextureProxy*,
+GrGLSLUniformHandler::SamplerHandle GrDawnUniformHandler::addSampler(const GrSurfaceProxy*,
                                                                      const GrSamplerState&,
                                                                      const GrSwizzle& swizzle,
                                                                      const char* name,
diff --git a/src/gpu/dawn/GrDawnUniformHandler.h b/src/gpu/dawn/GrDawnUniformHandler.h
index c22db12..ba653a4 100644
--- a/src/gpu/dawn/GrDawnUniformHandler.h
+++ b/src/gpu/dawn/GrDawnUniformHandler.h
@@ -34,7 +34,7 @@
 private:
     explicit GrDawnUniformHandler(GrGLSLProgramBuilder* program);
 
-    SamplerHandle addSampler(const GrTextureProxy*, const GrSamplerState&, const GrSwizzle&,
+    SamplerHandle addSampler(const GrSurfaceProxy*, const GrSamplerState&, const GrSwizzle&,
                              const char* name, const GrShaderCaps*) override;
     const char* samplerVariable(SamplerHandle handle) const override;
     GrSwizzle samplerSwizzle(SamplerHandle handle) const override;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index aeb3be1..5421de7 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2103,7 +2103,7 @@
         GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
         const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
         const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
-        const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+        const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     if (!fCachedOpsRenderPass) {
         fCachedOpsRenderPass.reset(new GrGLOpsRenderPass(this));
     }
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index fb597f5..0ceae9c 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -122,7 +122,7 @@
             GrRenderTarget*, GrSurfaceOrigin, const SkIRect&,
             const GrOpsRenderPass::LoadAndStoreInfo&,
             const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) override;
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) override;
 
     void invalidateBoundRenderTarget() {
         fHWBoundRenderTargetUniqueID.makeInvalid();
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 1e79e9f..a626f80 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -108,8 +108,9 @@
 }
 
 void GrGLProgram::updatePrimitiveProcessorTextureBindings(const GrPrimitiveProcessor& primProc,
-                                                          const GrTextureProxy* const proxies[]) {
+                                                          const GrSurfaceProxy* const proxies[]) {
     for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
+        SkASSERT(proxies[i]->asTextureProxy());
         auto* tex = static_cast<GrGLTexture*>(proxies[i]->peekTexture());
         fGpu->bindTexture(i, primProc.textureSampler(i).samplerState(),
                           primProc.textureSampler(i).swizzle(), tex);
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index cf2e2aa..5554e7e 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -122,7 +122,7 @@
     void updateUniformsAndTextureBindings(const GrRenderTarget*, const GrProgramInfo&);
 
     void updatePrimitiveProcessorTextureBindings(const GrPrimitiveProcessor&,
-                                                 const GrTextureProxy* const[]);
+                                                 const GrSurfaceProxy* const[]);
 
     int vertexStride() const { return fVertexStride; }
     int instanceStride() const { return fInstanceStride; }
diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp
index 56ed244..f888473 100644
--- a/src/gpu/gl/GrGLUniformHandler.cpp
+++ b/src/gpu/gl/GrGLUniformHandler.cpp
@@ -59,18 +59,19 @@
     return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
 }
 
-GrGLSLUniformHandler::SamplerHandle GrGLUniformHandler::addSampler(const GrTextureProxy* texture,
+GrGLSLUniformHandler::SamplerHandle GrGLUniformHandler::addSampler(const GrSurfaceProxy* texture,
                                                                    const GrSamplerState&,
                                                                    const GrSwizzle& swizzle,
                                                                    const char* name,
                                                                    const GrShaderCaps* shaderCaps) {
     SkASSERT(name && strlen(name));
+    SkASSERT(texture->asTextureProxy());
 
     SkString mangleName;
     char prefix = 'u';
     fProgramBuilder->nameVariable(&mangleName, prefix, name, true);
 
-    GrTextureType type = texture->textureType();
+    GrTextureType type = texture->backendFormat().textureType();
 
     UniformInfo& sampler = fSamplers.push_back();
     sampler.fVariable.setType(GrSLCombinedSamplerTypeForTextureType(type));
diff --git a/src/gpu/gl/GrGLUniformHandler.h b/src/gpu/gl/GrGLUniformHandler.h
index f577755..89549c7 100644
--- a/src/gpu/gl/GrGLUniformHandler.h
+++ b/src/gpu/gl/GrGLUniformHandler.h
@@ -42,7 +42,7 @@
         fUniforms[u.toIndex()].fVisibility |= visibility;
     }
 
-    SamplerHandle addSampler(const GrTextureProxy*, const GrSamplerState&, const GrSwizzle&,
+    SamplerHandle addSampler(const GrSurfaceProxy*, const GrSamplerState&, const GrSwizzle&,
                              const char* name, const GrShaderCaps*) override;
 
     const char* samplerVariable(SamplerHandle handle) const override {
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,
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index e6b8732..f50a80d 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -56,7 +56,7 @@
                                 GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
                                 const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
                                 const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-                                const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+                                const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     return new GrMockOpsRenderPass(this, rt, origin, colorInfo);
 }
 
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index a04e6c0..1fd97cc 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -28,7 +28,7 @@
             GrRenderTarget*, GrSurfaceOrigin, const SkIRect&,
             const GrOpsRenderPass::LoadAndStoreInfo&,
             const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) override;
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) override;
 
     GrFence SK_WARN_UNUSED_RESULT insertFence() override { return 0; }
     bool waitFence(GrFence, uint64_t) override { return true; }
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 4ec4858..4df71c5 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -80,7 +80,7 @@
             GrRenderTarget*, GrSurfaceOrigin, const SkIRect& bounds,
             const GrOpsRenderPass::LoadAndStoreInfo&,
             const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) override;
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) override;
 
     SkSL::Compiler* shaderCompiler() const { return fCompiler.get(); }
 
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 32e168f..e2da15a 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -159,7 +159,7 @@
             GrRenderTarget* renderTarget, GrSurfaceOrigin origin, const SkIRect& bounds,
             const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
             const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     return new GrMtlOpsRenderPass(this, renderTarget, origin, colorInfo, stencilInfo);
 }
 
diff --git a/src/gpu/mtl/GrMtlPipelineState.h b/src/gpu/mtl/GrMtlPipelineState.h
index a2e41f0..4562591 100644
--- a/src/gpu/mtl/GrMtlPipelineState.h
+++ b/src/gpu/mtl/GrMtlPipelineState.h
@@ -49,7 +49,7 @@
     void setData(const GrRenderTarget*, const GrProgramInfo&);
 
     void setTextures(const GrProgramInfo& programInfo,
-                     const GrTextureProxy* const primProcTextures[]);
+                     const GrSurfaceProxy* const primProcTextures[]);
     void bindTextures(id<MTLRenderCommandEncoder> renderCmdEncoder);
 
     void setDrawState(id<MTLRenderCommandEncoder>, const GrSwizzle& outputSwizzle,
diff --git a/src/gpu/mtl/GrMtlPipelineState.mm b/src/gpu/mtl/GrMtlPipelineState.mm
index cde1722..6f4ae8a 100644
--- a/src/gpu/mtl/GrMtlPipelineState.mm
+++ b/src/gpu/mtl/GrMtlPipelineState.mm
@@ -80,9 +80,10 @@
 }
 
 void GrMtlPipelineState::setTextures(const GrProgramInfo& programInfo,
-                                     const GrTextureProxy* const primProcTextures[]) {
+                                     const GrSurfaceProxy* const primProcTextures[]) {
     fSamplerBindings.reset();
     for (int i = 0; i < programInfo.primProc().numTextureSamplers(); ++i) {
+        SkASSERT(primProcTextures[i]->asTextureProxy());
         const auto& sampler = programInfo.primProc().textureSampler(i);
         auto texture = static_cast<GrMtlTexture*>(primProcTextures[i]->peekTexture());
         fSamplerBindings.emplace_back(sampler.samplerState(), texture, fGpu);
diff --git a/src/gpu/mtl/GrMtlUniformHandler.h b/src/gpu/mtl/GrMtlUniformHandler.h
index bcf15a0..89e3380 100644
--- a/src/gpu/mtl/GrMtlUniformHandler.h
+++ b/src/gpu/mtl/GrMtlUniformHandler.h
@@ -61,7 +61,7 @@
         fUniforms[u.toIndex()].fVisibility |= visibility;
     }
 
-    SamplerHandle addSampler(const GrTextureProxy*,
+    SamplerHandle addSampler(const GrSurfaceProxy*,
                              const GrSamplerState&,
                              const GrSwizzle&,
                              const char* name,
diff --git a/src/gpu/mtl/GrMtlUniformHandler.mm b/src/gpu/mtl/GrMtlUniformHandler.mm
index 89e1263..870d662 100644
--- a/src/gpu/mtl/GrMtlUniformHandler.mm
+++ b/src/gpu/mtl/GrMtlUniformHandler.mm
@@ -242,7 +242,7 @@
     return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
 }
 
-GrGLSLUniformHandler::SamplerHandle GrMtlUniformHandler::addSampler(const GrTextureProxy* texture,
+GrGLSLUniformHandler::SamplerHandle GrMtlUniformHandler::addSampler(const GrSurfaceProxy* texture,
                                                                     const GrSamplerState&,
                                                                     const GrSwizzle& swizzle,
                                                                     const char* name,
@@ -252,7 +252,7 @@
     char prefix = 'u';
     fProgramBuilder->nameVariable(&mangleName, prefix, name, true);
 
-    GrTextureType type = texture->textureType();
+    GrTextureType type = texture->backendFormat().textureType();
 
     UniformInfo& info = fSamplers.push_back();
     info.fVariable.setType(GrSLCombinedSamplerTypeForTextureType(type));
diff --git a/src/gpu/ops/GrMeshDrawOp.cpp b/src/gpu/ops/GrMeshDrawOp.cpp
index 0f6a733..bfd052b 100644
--- a/src/gpu/ops/GrMeshDrawOp.cpp
+++ b/src/gpu/ops/GrMeshDrawOp.cpp
@@ -89,7 +89,7 @@
     }
 
     if (numPrimitiveProcessorTextures) {
-        result->fPrimitiveProcessorTextures = arena->makeArrayDefault<GrTextureProxy*>(
+        result->fPrimitiveProcessorTextures = arena->makeArrayDefault<GrSurfaceProxy*>(
                         numPrimitiveProcessorTextures * numMeshes);
     }
 
@@ -109,7 +109,7 @@
         }
 
         if (numPrimProcTextures) {
-            result->fPrimitiveProcessorTextures = arena->makeArrayDefault<GrTextureProxy*>(
+            result->fPrimitiveProcessorTextures = arena->makeArrayDefault<GrSurfaceProxy*>(
                         numPrimProcTextures);
         }
         return result;
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 7ba78db..3025150 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -202,7 +202,7 @@
     // This should be called during onPrepare of a GrOp. The caller should add any proxies to the
     // array it will use that it did not access during a call to visitProxies. This is usually the
     // case for atlases.
-    virtual SkTArray<GrTextureProxy*, true>* sampledProxyArray() = 0;
+    virtual SkTArray<GrSurfaceProxy*, true>* sampledProxyArray() = 0;
 
     virtual const GrCaps& caps() const = 0;
 
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index 4d58666..2280f40 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -69,7 +69,7 @@
 
     virtual const char* name() const = 0;
 
-    using VisitProxyFunc = std::function<void(GrTextureProxy*, GrMipMapped)>;
+    using VisitProxyFunc = std::function<void(GrSurfaceProxy*, GrMipMapped)>;
 
     virtual void visitProxies(const VisitProxyFunc&) const {
         // This default implementation assumes the op has no proxies
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 0b687dd..47cdbe8 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -223,7 +223,7 @@
     void visitProxies(const VisitProxyFunc& func) const override {
         for (unsigned p = 0; p < fProxyCnt; ++p) {
             bool mipped = (GrSamplerState::Filter::kMipMap == this->filter());
-            func(fViewCountPairs[p].fProxyView.asTextureProxy(), GrMipMapped(mipped));
+            func(fViewCountPairs[p].fProxyView.proxy(), GrMipMapped(mipped));
         }
     }
 
@@ -335,7 +335,7 @@
         // Helper to fill in the fFixedDynamicState and fDynamicStateArrays. If there is more
         // than one mesh/proxy they are stored in fDynamicStateArrays but if there is only one
         // it is stored in fFixedDynamicState.
-        void setMeshProxy(int index, GrTextureProxy* proxy) {
+        void setMeshProxy(int index, GrSurfaceProxy* proxy) {
             SkASSERT(index < fNumProxies);
 
             if (fDynamicStateArrays) {
@@ -462,7 +462,7 @@
             fTotNumQuads += 1;
             curProxy = fViewCountPairs[p].fProxyView.proxy();
             SkASSERT(curProxy->backendFormat().textureType() ==
-                     fViewCountPairs[0].fProxyView.asTextureProxy()->textureType());
+                     fViewCountPairs[0].fProxyView.proxy()->backendFormat().textureType());
             SkASSERT(curProxy->config() == fViewCountPairs[0].fProxyView.proxy()->config());
 
             SkMatrix ctm = viewMatrix;
@@ -591,7 +591,7 @@
         for (const auto& op : ChainRange<TextureOp>(texOp)) {
             auto iter = op.fQuads.iterator();
             for (unsigned p = 0; p < op.fProxyCnt; ++p) {
-                GrTextureProxy* proxy = op.fViewCountPairs[p].fProxyView.asTextureProxy();
+                GrSurfaceProxy* proxy = op.fViewCountPairs[p].fProxyView.proxy();
 
                 const int quadCnt = op.fViewCountPairs[p].fQuadCnt;
                 SkDEBUGCODE(int meshVertexCnt = quadCnt * desc->fVertexSpec.verticesPerQuad());
@@ -638,6 +638,7 @@
 
 #ifdef SK_DEBUG
     void validate() const override {
+        // NOTE: Since this is debug-only code, we use the virtual asTextureProxy()
         auto textureType = fViewCountPairs[0].fProxyView.asTextureProxy()->textureType();
         GrAAType aaType = this->aaType();
 
@@ -878,8 +879,8 @@
         }
         const auto& thisView = fViewCountPairs[0].fProxyView;
         const auto& thatView = that->fViewCountPairs[0].fProxyView;
-        auto thisProxy = thisView.asTextureProxy();
-        auto thatProxy = thatView.asTextureProxy();
+        auto thisProxy = thisView.proxy();
+        auto thatProxy = thatView.proxy();
         if (fProxyCnt > 1 || that->fProxyCnt > 1 || thisView != thatView) {
             // We can't merge across different proxies. Check if 'this' can be chained with 'that'.
             if (GrTextureProxy::ProxiesAreCompatibleAsDynamicState(thisProxy, thatProxy) &&
@@ -954,9 +955,8 @@
                                             const GrQuad& deviceQuad,
                                             const GrQuad& localQuad,
                                             const SkRect* domain) {
-    GrTextureProxy* proxy = proxyView.asTextureProxy();
     // Apply optimizations that are valid whether or not using GrTextureOp or GrFillRectOp
-    if (domain && domain->contains(proxy->backingStoreBoundsRect())) {
+    if (domain && domain->contains(proxyView.proxy()->backingStoreBoundsRect())) {
         // No need for a shader-based domain if hardware clamping achieves the same effect
         domain = nullptr;
     }
@@ -974,6 +974,7 @@
         paint.setColor4f(color);
         paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
 
+        GrTextureProxy* proxy = proxyView.asTextureProxy();
         std::unique_ptr<GrFragmentProcessor> fp;
         if (domain) {
             // Update domain to match what GrTextureOp would do for bilerp, but don't do any
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 9fbab33..db65b40 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -322,7 +322,7 @@
             GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
             const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
             const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     if (!fCachedOpsRenderPass) {
         fCachedOpsRenderPass.reset(new GrVkOpsRenderPass(this));
     }
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index b1c1d20..69f418c 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -100,7 +100,7 @@
             GrRenderTarget*, GrSurfaceOrigin, const SkIRect&,
             const GrOpsRenderPass::LoadAndStoreInfo&,
             const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-            const SkTArray<GrTextureProxy*, true>& sampledProxies) override;
+            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) override;
 
     void addBufferMemoryBarrier(const GrVkResource*,
                                 VkPipelineStageFlags srcStageMask,
diff --git a/src/gpu/vk/GrVkOpsRenderPass.cpp b/src/gpu/vk/GrVkOpsRenderPass.cpp
index fa0d96a..6b2b511 100644
--- a/src/gpu/vk/GrVkOpsRenderPass.cpp
+++ b/src/gpu/vk/GrVkOpsRenderPass.cpp
@@ -193,7 +193,7 @@
 bool GrVkOpsRenderPass::set(GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
                             const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
                             const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
-                            const SkTArray<GrTextureProxy*, true>& sampledProxies) {
+                            const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
     SkASSERT(!fRenderTarget);
     SkASSERT(fGpu == rt->getContext()->priv().getGpu());
 
@@ -205,6 +205,7 @@
 
     for (int i = 0; i < sampledProxies.count(); ++i) {
         if (sampledProxies[i]->isInstantiated()) {
+            SkASSERT(sampledProxies[i]->asTextureProxy());
             GrVkTexture* vkTex = static_cast<GrVkTexture*>(sampledProxies[i]->peekTexture());
             SkASSERT(vkTex);
             vkTex->setImageLayout(
diff --git a/src/gpu/vk/GrVkOpsRenderPass.h b/src/gpu/vk/GrVkOpsRenderPass.h
index 4ec59af..07c52ed 100644
--- a/src/gpu/vk/GrVkOpsRenderPass.h
+++ b/src/gpu/vk/GrVkOpsRenderPass.h
@@ -41,7 +41,7 @@
     bool set(GrRenderTarget*, GrSurfaceOrigin, const SkIRect& bounds,
              const GrOpsRenderPass::LoadAndStoreInfo&,
              const GrOpsRenderPass::StencilLoadAndStoreInfo&,
-             const SkTArray<GrTextureProxy*, true>& sampledProxies);
+             const SkTArray<GrSurfaceProxy*, true>& sampledProxies);
     void reset();
 
     void submit();
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 9cca9b1..f41c53d 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -150,7 +150,7 @@
 bool GrVkPipelineState::setAndBindTextures(GrVkGpu* gpu,
                                            const GrPrimitiveProcessor& primProc,
                                            const GrPipeline& pipeline,
-                                           const GrTextureProxy* const primProcTextures[],
+                                           const GrSurfaceProxy* const primProcTextures[],
                                            GrVkCommandBuffer* commandBuffer) {
     SkASSERT(primProcTextures || !primProc.numTextureSamplers());
 
@@ -162,6 +162,7 @@
     int currTextureBinding = 0;
 
     for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
+        SkASSERT(primProcTextures[i]->asTextureProxy());
         const auto& sampler = primProc.textureSampler(i);
         auto texture = static_cast<GrVkTexture*>(primProcTextures[i]->peekTexture());
         samplerBindings[currTextureBinding++] = {sampler.samplerState(), texture};
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index 1b1cdaf..8d973df 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -59,7 +59,7 @@
      * bindings.
      */
     bool setAndBindTextures(GrVkGpu*, const GrPrimitiveProcessor&, const GrPipeline&,
-                            const GrTextureProxy* const primitiveProcessorTextures[],
+                            const GrSurfaceProxy* const primitiveProcessorTextures[],
                             GrVkCommandBuffer*);
 
     void bindPipeline(const GrVkGpu* gpu, GrVkCommandBuffer* commandBuffer);
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index 6df62ce..06bd934 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -254,17 +254,19 @@
     return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
 }
 
-GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(const GrTextureProxy* texture,
+GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(const GrSurfaceProxy* texture,
                                                                    const GrSamplerState& state,
                                                                    const GrSwizzle& swizzle,
                                                                    const char* name,
                                                                    const GrShaderCaps* shaderCaps) {
     SkASSERT(name && strlen(name));
+    SkASSERT(texture->asTextureProxy());
+
     SkString mangleName;
     char prefix = 'u';
     fProgramBuilder->nameVariable(&mangleName, prefix, name, true);
 
-    GrTextureType type = texture->textureType();
+    GrTextureType type = texture->backendFormat().textureType();
 
     UniformInfo& info = fSamplers.push_back();
     info.fVariable.setType(GrSLCombinedSamplerTypeForTextureType(type));
diff --git a/src/gpu/vk/GrVkUniformHandler.h b/src/gpu/vk/GrVkUniformHandler.h
index 76f82f0..33eaa07 100644
--- a/src/gpu/vk/GrVkUniformHandler.h
+++ b/src/gpu/vk/GrVkUniformHandler.h
@@ -77,7 +77,7 @@
         fUniforms[u.toIndex()].fVisibility |= visibility;
     }
 
-    SamplerHandle addSampler(const GrTextureProxy*,
+    SamplerHandle addSampler(const GrSurfaceProxy*,
                              const GrSamplerState&,
                              const GrSwizzle&,
                              const char* name,