Switch GrMeshDrawOp::Target to be the stand alone GrMeshDrawTarget class

The Tessellator classes will survive in the NGA and they use
GrMeshDrawOp::Target - but GrMeshDrawOp will not survive.

This is a prelude to making all the remaining GrOp-derived classes OGA-only.

Bug: skia:11837
Change-Id: I62dc92e5f42d672342113f12dcedf3435fab993f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419198
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/bench/TessellateBench.cpp b/bench/TessellateBench.cpp
index 6a96581..2c46c1d 100644
--- a/bench/TessellateBench.cpp
+++ b/bench/TessellateBench.cpp
@@ -10,7 +10,6 @@
 #include "src/core/SkPathPriv.h"
 #include "src/core/SkRectPriv.h"
 #include "src/gpu/GrDirectContextPriv.h"
-#include "src/gpu/GrOpFlushState.h"
 #include "src/gpu/geometry/GrWangsFormula.h"
 #include "src/gpu/mock/GrMockOpTarget.h"
 #include "src/gpu/tessellate/GrMiddleOutPolygonTriangulator.h"
diff --git a/bench/VertexColorSpaceBench.cpp b/bench/VertexColorSpaceBench.cpp
index ed7a81b..aa1ed37 100644
--- a/bench/VertexColorSpaceBench.cpp
+++ b/bench/VertexColorSpaceBench.cpp
@@ -191,7 +191,7 @@
                                                                    GrPipeline::InputFlags::kNone);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
         }
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index fe31a17..04e9858 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -178,7 +178,7 @@
         return tmp;
     }
 
-    void onPrepareDraws(Target* target) final {
+    void onPrepareDraws(GrMeshDrawTarget* target) final {
         QuadHelper helper(target, sizeof(Vertex), 1);
         Vertex* verts = reinterpret_cast<Vertex*>(helper.vertices());
         if (!verts) {
@@ -382,7 +382,7 @@
         return tmp;
     }
 
-    void onPrepareDraws(Target* target) final {
+    void onPrepareDraws(GrMeshDrawTarget* target) final {
         QuadHelper helper(target, sizeof(Vertex), 1);
         Vertex* verts = reinterpret_cast<Vertex*>(helper.vertices());
         if (!verts) {
diff --git a/gn/gpu.gni b/gn/gpu.gni
index e3a4b2c..e2b8bae 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -127,6 +127,7 @@
   "$_src/gpu/GrManagedResource.h",
   "$_src/gpu/GrMemoryPool.cpp",
   "$_src/gpu/GrMemoryPool.h",
+  "$_src/gpu/GrMeshDrawTarget.h",
   "$_src/gpu/GrNativeRect.h",
   "$_src/gpu/GrNonAtomicRef.h",
   "$_src/gpu/GrOnFlushResourceProvider.cpp",
@@ -252,6 +253,7 @@
   "$_src/gpu/GrUserStencilSettings.h",
   "$_src/gpu/GrUtil.cpp",
   "$_src/gpu/GrUtil.h",
+  "$_src/gpu/GrVertexChunkArray.cpp",
   "$_src/gpu/GrVertexChunkArray.h",
   "$_src/gpu/GrVertexWriter.h",
   "$_src/gpu/GrVx.h",
diff --git a/src/gpu/GrEagerVertexAllocator.cpp b/src/gpu/GrEagerVertexAllocator.cpp
index 1073c81..86eaf90 100644
--- a/src/gpu/GrEagerVertexAllocator.cpp
+++ b/src/gpu/GrEagerVertexAllocator.cpp
@@ -7,6 +7,33 @@
 
 #include "src/gpu/GrEagerVertexAllocator.h"
 
+#include "src/gpu/GrMeshDrawTarget.h"
+
+//-------------------------------------------------------------------------------------------------
+void* GrEagerDynamicVertexAllocator::lock(size_t stride, int eagerCount) {
+    SkASSERT(!fLockCount);
+    SkASSERT(eagerCount);
+    if (void* data = fTarget->makeVertexSpace(stride, eagerCount, fVertexBuffer, fBaseVertex)) {
+        fLockStride = stride;
+        fLockCount = eagerCount;
+        return data;
+    }
+    fVertexBuffer->reset();
+    *fBaseVertex = 0;
+    return nullptr;
+}
+
+void GrEagerDynamicVertexAllocator::unlock(int actualCount) {
+    SkASSERT(fLockCount);
+    SkASSERT(actualCount <= fLockCount);
+    fTarget->putBackVertices(fLockCount - actualCount, fLockStride);
+    if (!actualCount) {
+        fVertexBuffer->reset();
+        *fBaseVertex = 0;
+    }
+    fLockCount = 0;
+}
+
 //-------------------------------------------------------------------------------------------------
 void* GrCpuVertexAllocator::lock(size_t stride, int eagerCount) {
     SkASSERT(!fLockStride && !fVertices && !fVertexData);
diff --git a/src/gpu/GrEagerVertexAllocator.h b/src/gpu/GrEagerVertexAllocator.h
index 73531f4..7828b0e 100644
--- a/src/gpu/GrEagerVertexAllocator.h
+++ b/src/gpu/GrEagerVertexAllocator.h
@@ -9,7 +9,8 @@
 #define GrEagerVertexAllocator_DEFINED
 
 #include "src/gpu/GrThreadSafeCache.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
+
+class GrMeshDrawTarget;
 
 // This interface is used to allocate and map GPU vertex data before the exact number of required
 // vertices is known. Usage pattern:
@@ -32,11 +33,11 @@
     virtual ~GrEagerVertexAllocator() {}
 };
 
-// GrEagerVertexAllocator implementation that uses GrMeshDrawOp::Target::makeVertexSpace and
-// GrMeshDrawOp::Target::putBackVertices.
+// GrEagerVertexAllocator implementation that uses GrMeshDrawTarget::makeVertexSpace and
+// GrMeshDrawTarget::putBackVertices.
 class GrEagerDynamicVertexAllocator : public GrEagerVertexAllocator {
 public:
-    GrEagerDynamicVertexAllocator(GrMeshDrawOp::Target* target,
+    GrEagerDynamicVertexAllocator(GrMeshDrawTarget* target,
                                   sk_sp<const GrBuffer>* vertexBuffer,
                                   int* baseVertex)
             : fTarget(target)
@@ -54,33 +55,13 @@
     using GrEagerVertexAllocator::lock;
 
     // Mark "final" as a hint for the compiler to not use the vtable.
-    void* lock(size_t stride, int eagerCount) final {
-        SkASSERT(!fLockCount);
-        SkASSERT(eagerCount);
-        if (void* data = fTarget->makeVertexSpace(stride, eagerCount, fVertexBuffer, fBaseVertex)) {
-            fLockStride = stride;
-            fLockCount = eagerCount;
-            return data;
-        }
-        fVertexBuffer->reset();
-        *fBaseVertex = 0;
-        return nullptr;
-    }
+    void* lock(size_t stride, int eagerCount) final;
 
     // Mark "final" as a hint for the compiler to not use the vtable.
-    void unlock(int actualCount) final {
-        SkASSERT(fLockCount);
-        SkASSERT(actualCount <= fLockCount);
-        fTarget->putBackVertices(fLockCount - actualCount, fLockStride);
-        if (!actualCount) {
-            fVertexBuffer->reset();
-            *fBaseVertex = 0;
-        }
-        fLockCount = 0;
-    }
+    void unlock(int actualCount) final;
 
 private:
-    GrMeshDrawOp::Target* const fTarget;
+    GrMeshDrawTarget* const fTarget;
     sk_sp<const GrBuffer>* const fVertexBuffer;
     int* const fBaseVertex;
 
diff --git a/src/gpu/GrMeshDrawTarget.h b/src/gpu/GrMeshDrawTarget.h
new file mode 100644
index 0000000..1caa788
--- /dev/null
+++ b/src/gpu/GrMeshDrawTarget.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrMeshDrawTarget_DEFINED
+#define GrMeshDrawTarget_DEFINED
+
+#include "src/gpu/GrDrawIndirectCommand.h"
+#include "src/gpu/GrSimpleMesh.h"
+
+/*
+ * Abstract interface that supports creating vertices, indices, and meshes, as well as
+ * invoking GPU draw operations.
+ */
+class GrMeshDrawTarget {
+public:
+    virtual ~GrMeshDrawTarget() {}
+
+    /** Adds a draw of a mesh. 'primProcProxies' must have
+     * GrGeometryProcessor::numTextureSamplers() entries. Can be null if no samplers.
+     */
+    virtual void recordDraw(const GrGeometryProcessor*,
+                            const GrSimpleMesh[],
+                            int meshCnt,
+                            const GrSurfaceProxy* const primProcProxies[],
+                            GrPrimitiveType) = 0;
+
+    /**
+     * Helper for drawing GrSimpleMesh(es) with zero primProc textures.
+     */
+    void recordDraw(const GrGeometryProcessor* gp,
+                    const GrSimpleMesh meshes[],
+                    int meshCnt,
+                    GrPrimitiveType primitiveType) {
+        this->recordDraw(gp, meshes, meshCnt, nullptr, primitiveType);
+    }
+
+    /**
+     * Makes space for vertex data. The returned pointer is the location where vertex data
+     * should be written. On return the buffer that will hold the data as well as an offset into
+     * the buffer (in 'vertexSize' units) where the data will be placed.
+     */
+    virtual void* makeVertexSpace(size_t vertexSize, int vertexCount, sk_sp<const GrBuffer>*,
+                                  int* startVertex) = 0;
+
+    /**
+     * Makes space for index data. The returned pointer is the location where index data
+     * should be written. On return the buffer that will hold the data as well as an offset into
+     * the buffer (in uint16_t units) where the data will be placed.
+     */
+    virtual uint16_t* makeIndexSpace(int indexCount, sk_sp<const GrBuffer>*, int* startIndex) = 0;
+
+    /**
+     * This is similar to makeVertexSpace. It allows the caller to use up to 'actualVertexCount'
+     * vertices in the returned pointer, which may exceed 'minVertexCount'.
+     * 'fallbackVertexCount' is the maximum number of vertices that should be allocated if a new
+     * buffer is allocated on behalf of this request.
+     */
+    virtual void* makeVertexSpaceAtLeast(size_t vertexSize, int minVertexCount,
+                                         int fallbackVertexCount, sk_sp<const GrBuffer>*,
+                                         int* startVertex, int* actualVertexCount) = 0;
+
+    /**
+     * This is similar to makeIndexSpace. It allows the caller to use up to 'actualIndexCount'
+     * indices in the returned pointer, which may exceed 'minIndexCount'.
+     * 'fallbackIndexCount' is the maximum number of indices that should be allocated if a new
+     * buffer is allocated on behalf of this request.
+     */
+    virtual uint16_t* makeIndexSpaceAtLeast(int minIndexCount, int fallbackIndexCount,
+                                            sk_sp<const GrBuffer>*, int* startIndex,
+                                            int* actualIndexCount) = 0;
+
+    /**
+     * Makes space for elements in a draw-indirect buffer. Upon success, the returned pointer is a
+     * CPU mapping where the data should be written.
+     */
+    virtual GrDrawIndirectWriter makeDrawIndirectSpace(int drawCount, sk_sp<const GrBuffer>* buffer,
+                                                       size_t* offsetInBytes) = 0;
+
+    /**
+     * Makes space for elements in a draw-indexed-indirect buffer. Upon success, the returned
+     * pointer is a CPU mapping where the data should be written.
+     */
+    virtual GrDrawIndexedIndirectWriter makeDrawIndexedIndirectSpace(int drawCount,
+                                                                     sk_sp<const GrBuffer>*,
+                                                                     size_t* offsetInBytes) = 0;
+
+    /** Helpers for ops which over-allocate and then return excess data to the pool. */
+    virtual void putBackIndices(int indices) = 0;
+    virtual void putBackVertices(int vertices, size_t vertexStride) = 0;
+    virtual void putBackIndirectDraws(int count) = 0;
+    virtual void putBackIndexedIndirectDraws(int count) = 0;
+
+    GrSimpleMesh* allocMesh() { return this->allocator()->make<GrSimpleMesh>(); }
+    GrSimpleMesh* allocMeshes(int n) { return this->allocator()->makeArray<GrSimpleMesh>(n); }
+    const GrSurfaceProxy** allocPrimProcProxyPtrs(int n) {
+        return this->allocator()->makeArray<const GrSurfaceProxy*>(n);
+    }
+
+    virtual GrRenderTargetProxy* rtProxy() const = 0;
+    virtual const GrSurfaceProxyView& writeView() const = 0;
+
+    virtual const GrAppliedClip* appliedClip() const = 0;
+    virtual GrAppliedClip detachAppliedClip() = 0;
+
+    virtual const GrDstProxyView& dstProxyView() const = 0;
+    virtual bool usesMSAASurface() const = 0;
+
+    virtual GrXferBarrierFlags renderPassBarriers() const = 0;
+
+    virtual GrLoadOp colorLoadOp() const = 0;
+
+    virtual GrThreadSafeCache* threadSafeCache() const = 0;
+    virtual GrResourceProvider* resourceProvider() const = 0;
+    uint32_t contextUniqueID() const { return this->resourceProvider()->contextUniqueID(); }
+
+    virtual GrStrikeCache* strikeCache() const = 0;
+    virtual GrAtlasManager* atlasManager() const = 0;
+    virtual GrSmallPathAtlasMgr* smallPathAtlasManager() const = 0;
+
+    // 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<GrSurfaceProxy*, true>* sampledProxyArray() = 0;
+
+    virtual const GrCaps& caps() const = 0;
+
+    virtual GrDeferredUploadTarget* deferredUploadTarget() = 0;
+
+    virtual SkArenaAlloc* allocator() = 0;
+};
+
+#endif
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 61bcb39..e2e5b39 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -14,6 +14,7 @@
 #include "src/gpu/GrAppliedClip.h"
 #include "src/gpu/GrBufferAllocPool.h"
 #include "src/gpu/GrDeferredUpload.h"
+#include "src/gpu/GrMeshDrawTarget.h"
 #include "src/gpu/GrProgramInfo.h"
 #include "src/gpu/GrRenderTargetProxy.h"
 #include "src/gpu/GrSurfaceProxyView.h"
@@ -24,7 +25,7 @@
 class GrResourceProvider;
 
 /** Tracks the state across all the GrOps (really just the GrDrawOps) in a GrOpsTask flush. */
-class GrOpFlushState final : public GrDeferredUploadTarget, public GrMeshDrawOp::Target {
+class GrOpFlushState final : public GrDeferredUploadTarget, public GrMeshDrawTarget {
 public:
     // vertexSpace and indexSpace may either be null or an alloation of size
     // GrBufferAllocPool::kDefaultBufferSize. If the latter, then CPU memory is only allocated for
@@ -123,7 +124,7 @@
     GrDeferredUploadToken addInlineUpload(GrDeferredTextureUploadFn&&) final;
     GrDeferredUploadToken addASAPUpload(GrDeferredTextureUploadFn&&) final;
 
-    /** Overrides of GrMeshDrawOp::Target. */
+    /** Overrides of GrMeshDrawTarget. */
     void recordDraw(const GrGeometryProcessor*,
                     const GrSimpleMesh[],
                     int meshCnt,
@@ -186,7 +187,7 @@
     GrAtlasManager* atlasManager() const final;
     GrSmallPathAtlasMgr* smallPathAtlasManager() const final;
 
-    /** GrMeshDrawOp::Target override. */
+    /** GrMeshDrawTarget override. */
     SkArenaAlloc* allocator() override { return &fArena; }
 
     // This is a convenience method that binds the given pipeline, and then, if our applied clip has
diff --git a/src/gpu/GrThreadSafeCache.h b/src/gpu/GrThreadSafeCache.h
index 8b08ff5..b44e706 100644
--- a/src/gpu/GrThreadSafeCache.h
+++ b/src/gpu/GrThreadSafeCache.h
@@ -13,10 +13,9 @@
 #include "src/core/SkArenaAlloc.h"
 #include "src/core/SkTDynamicHash.h"
 #include "src/core/SkTInternalLList.h"
+#include "src/gpu/GrGpuBuffer.h"
 #include "src/gpu/GrSurfaceProxyView.h"
 
-class GrGpuBuffer;
-
 // Ganesh creates a lot of utility textures (e.g., blurred-rrect masks) that need to be shared
 // between the direct context and all the DDL recording contexts. This thread-safe cache
 // allows this sharing.
diff --git a/src/gpu/GrVertexChunkArray.cpp b/src/gpu/GrVertexChunkArray.cpp
new file mode 100644
index 0000000..27490f6
--- /dev/null
+++ b/src/gpu/GrVertexChunkArray.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2021 Google LLC.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/GrVertexChunkArray.h"
+
+#include "src/gpu/GrMeshDrawTarget.h"
+
+GrVertexChunkBuilder::~GrVertexChunkBuilder() {
+    if (!fChunks->empty()) {
+        fTarget->putBackVertices(fCurrChunkVertexCapacity - fCurrChunkVertexCount, fStride);
+        fChunks->back().fCount = fCurrChunkVertexCount;
+    }
+}
+
+bool GrVertexChunkBuilder::allocChunk(int minCount) {
+    if (!fChunks->empty()) {
+        // No need to put back vertices; the buffer is full.
+        fChunks->back().fCount = fCurrChunkVertexCount;
+    }
+    fCurrChunkVertexCount = 0;
+    GrVertexChunk* chunk = &fChunks->push_back();
+    int minAllocCount = std::max(minCount, fMinVerticesPerChunk);
+    fCurrChunkVertexWriter = {fTarget->makeVertexSpaceAtLeast(fStride, minAllocCount,
+                                                                minAllocCount, &chunk->fBuffer,
+                                                                &chunk->fBase,
+                                                                &fCurrChunkVertexCapacity)};
+    if (!fCurrChunkVertexWriter || !chunk->fBuffer || fCurrChunkVertexCapacity < minCount) {
+        SkDebugf("WARNING: Failed to allocate vertex buffer for GrVertexChunk.\n");
+        fChunks->pop_back();
+        SkASSERT(fCurrChunkVertexCount == 0);
+        fCurrChunkVertexCapacity = 0;
+        return false;
+    }
+    fMinVerticesPerChunk *= 2;
+    return true;
+}
diff --git a/src/gpu/GrVertexChunkArray.h b/src/gpu/GrVertexChunkArray.h
index b559bfc..3d570d8 100644
--- a/src/gpu/GrVertexChunkArray.h
+++ b/src/gpu/GrVertexChunkArray.h
@@ -12,7 +12,8 @@
 #include "include/private/SkTArray.h"
 #include "src/gpu/GrBuffer.h"
 #include "src/gpu/GrVertexWriter.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
+
+class GrMeshDrawTarget;
 
 // Represents a chunk of vertex data. Use with GrVertexChunkArray and GrVertexChunkBuilder. We write
 // the data out in chunks when we don't start out knowing exactly how many vertices (or instances)
@@ -33,7 +34,7 @@
 // entire lifetime of this object.
 class GrVertexChunkBuilder : SkNoncopyable {
 public:
-    GrVertexChunkBuilder(GrMeshDrawOp::Target* target, GrVertexChunkArray* chunks, size_t stride,
+    GrVertexChunkBuilder(GrMeshDrawTarget* target, GrVertexChunkArray* chunks, size_t stride,
                          int minVerticesPerChunk)
             : fTarget(target)
             , fChunks(chunks)
@@ -42,12 +43,7 @@
         SkASSERT(fMinVerticesPerChunk > 0);
     }
 
-    ~GrVertexChunkBuilder() {
-        if (!fChunks->empty()) {
-            fTarget->putBackVertices(fCurrChunkVertexCapacity - fCurrChunkVertexCount, fStride);
-            fChunks->back().fCount = fCurrChunkVertexCount;
-        }
-    }
+    ~GrVertexChunkBuilder();
 
     // Appends 'count' contiguous vertices. These vertices are not guaranteed to be contiguous with
     // previous or future calls to appendVertices.
@@ -78,30 +74,9 @@
     }
 
 private:
-    bool allocChunk(int minCount) {
-        if (!fChunks->empty()) {
-            // No need to put back vertices; the buffer is full.
-            fChunks->back().fCount = fCurrChunkVertexCount;
-        }
-        fCurrChunkVertexCount = 0;
-        GrVertexChunk* chunk = &fChunks->push_back();
-        int minAllocCount = std::max(minCount, fMinVerticesPerChunk);
-        fCurrChunkVertexWriter = {fTarget->makeVertexSpaceAtLeast(fStride, minAllocCount,
-                                                                  minAllocCount, &chunk->fBuffer,
-                                                                  &chunk->fBase,
-                                                                  &fCurrChunkVertexCapacity)};
-        if (!fCurrChunkVertexWriter || !chunk->fBuffer || fCurrChunkVertexCapacity < minCount) {
-            SkDebugf("WARNING: Failed to allocate vertex buffer for GrVertexChunk.\n");
-            fChunks->pop_back();
-            SkASSERT(fCurrChunkVertexCount == 0);
-            fCurrChunkVertexCapacity = 0;
-            return false;
-        }
-        fMinVerticesPerChunk *= 2;
-        return true;
-    }
+    bool allocChunk(int minCount);
 
-    GrMeshDrawOp::Target* const fTarget;
+    GrMeshDrawTarget* const fTarget;
     GrVertexChunkArray* const fChunks;
     const size_t fStride;
     int fMinVerticesPerChunk;
diff --git a/src/gpu/mock/GrMockOpTarget.h b/src/gpu/mock/GrMockOpTarget.h
index 8f76518..f9ff83b 100644
--- a/src/gpu/mock/GrMockOpTarget.h
+++ b/src/gpu/mock/GrMockOpTarget.h
@@ -9,14 +9,15 @@
 #define GrMockOpTarget_DEFINED
 
 #include "include/gpu/GrDirectContext.h"
+#include "src/gpu/GrAppliedClip.h"
 #include "src/gpu/GrDirectContextPriv.h"
 #include "src/gpu/GrDstProxyView.h"
 #include "src/gpu/GrGpu.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
+#include "src/gpu/GrMeshDrawTarget.h"
 
-// This is a mock GrMeshDrawOp::Target implementation that just gives back pointers into
+// This is a mock GrMeshDrawTarget implementation that just gives back pointers into
 // pre-allocated CPU buffers, rather than allocating and mapping GPU buffers.
-class GrMockOpTarget : public GrMeshDrawOp::Target {
+class GrMockOpTarget : public GrMeshDrawTarget {
 public:
     GrMockOpTarget(sk_sp<GrDirectContext> mockContext) : fMockContext(std::move(mockContext)) {
         fStaticVertexBuffer = fMockContext->priv().getGpu()->createBuffer(
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 21c712c..660bcc0 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -775,7 +775,7 @@
                                                             renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         int instanceCount = fPaths.count();
 
         if (!fProgramInfo) {
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 7c2a79b..6c10f27 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -919,7 +919,7 @@
                            GrXferBarrierFlags renderPassXferBarriers,
                            GrLoadOp colorLoadOp) override;
 
-    void onPrepareDraws(Target*) override;
+    void onPrepareDraws(GrMeshDrawTarget*) override;
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 
     typedef SkTArray<SkPoint, true> PtArray;
@@ -1171,7 +1171,7 @@
     context->priv().recordProgramInfo(fProgramInfos[2]);
 }
 
-void AAHairlineOp::onPrepareDraws(Target* target) {
+void AAHairlineOp::onPrepareDraws(GrMeshDrawTarget* target) {
     // Setup the viewmatrix and localmatrix for the GrGeometryProcessor.
     SkMatrix invert;
     if (!this->viewMatrix().invert(&invert)) {
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index 780fa80..e19b57e 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -221,7 +221,7 @@
                                                             renderPassXferBarriers, colorLoadOp);
     }
 
-    void recordDraw(Target* target,
+    void recordDraw(GrMeshDrawTarget* target,
                     int vertexCount, size_t vertexStride, void* vertices,
                     int indexCount, uint16_t* indices) {
         if (vertexCount == 0 || indexCount == 0) {
@@ -251,7 +251,7 @@
         fMeshes.push_back(mesh);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index bd5adf4..3727a44 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -195,7 +195,7 @@
     return analysis;
 }
 
-void GrAtlasTextOp::onPrepareDraws(Target* target) {
+void GrAtlasTextOp::onPrepareDraws(GrMeshDrawTarget* target) {
     auto resourceProvider = target->resourceProvider();
 
     // If we need local coordinates, compute an inverse view matrix. If this is solid color, the
@@ -334,7 +334,7 @@
 }
 
 void GrAtlasTextOp::createDrawForGeneratedGlyphs(
-        GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
+        GrMeshDrawTarget* target, FlushInfo* flushInfo) const {
     if (!flushInfo->fGlyphsToFlush) {
         return;
     }
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index bd0c46e..b0a333a 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -189,7 +189,7 @@
         // TODO [PI]: implement
     }
 
-    void onPrepareDraws(Target*) override;
+    void onPrepareDraws(GrMeshDrawTarget*) override;
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 
 #if GR_TEST_UTILS
@@ -227,7 +227,7 @@
     }
 
     inline void createDrawForGeneratedGlyphs(
-            GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const;
+            GrMeshDrawTarget* target, FlushInfo* flushInfo) const;
 
     MaskType maskType() const { return static_cast<MaskType>(fMaskType); }
 
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 1ae324e..e3cf01f 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -364,7 +364,7 @@
                                                                    fStencilSettings);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         int instanceCount = fLines.count();
         SkPaint::Cap cap = this->cap();
         DashCap capType = (SkPaint::kRound_Cap == cap) ? kRound_DashCap : kNonRound_DashCap;
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index e84e38f..f9ced05 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -68,7 +68,7 @@
 class PathGeoBuilder {
 public:
     PathGeoBuilder(GrPrimitiveType primitiveType,
-                   GrMeshDrawOp::Target* target,
+                   GrMeshDrawTarget* target,
                    SkTDArray<GrSimpleMesh*>* meshes)
             : fPrimitiveType(primitiveType)
             , fTarget(target)
@@ -334,7 +334,7 @@
     }
 
     GrPrimitiveType fPrimitiveType;
-    GrMeshDrawOp::Target* fTarget;
+    GrMeshDrawTarget* fTarget;
     size_t fVertexStride;
 
     sk_sp<const GrBuffer> fVertexBuffer;
@@ -461,7 +461,7 @@
 
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         PathGeoBuilder pathGeoBuilder(this->primType(), target, &fMeshes);
 
         // fill buffers
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index 1b11b06..857648a 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -59,7 +59,7 @@
                              GrXferBarrierFlags renderPassXferBarriers,
                              GrLoadOp colorLoadOp) override;
 
-    void onPrepareDraws(Target*) override;
+    void onPrepareDraws(GrMeshDrawTarget*) override;
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 #if GR_TEST_UTILS
     SkString onDumpInfo() const override;
@@ -216,7 +216,7 @@
                                              renderPassXferBarriers, colorLoadOp);
 }
 
-void DrawAtlasOp::onPrepareDraws(Target* target) {
+void DrawAtlasOp::onPrepareDraws(GrMeshDrawTarget* target) {
     if (!fProgramInfo) {
         this->createProgramInfo(target);
     }
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 97c60d3..df2a79c 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -239,7 +239,7 @@
                              GrXferBarrierFlags renderPassXferBarriers,
                              GrLoadOp colorLoadOp) override;
 
-    void onPrepareDraws(Target*) override;
+    void onPrepareDraws(GrMeshDrawTarget*) override;
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 #if GR_TEST_UTILS
     SkString onDumpInfo() const override;
@@ -404,7 +404,7 @@
                                              renderPassXferBarriers, colorLoadOp);
 }
 
-void DrawVerticesOp::onPrepareDraws(Target* target) {
+void DrawVerticesOp::onPrepareDraws(GrMeshDrawTarget* target) {
     // Allocate buffers.
     size_t vertexStride = this->vertexStride();
     sk_sp<const GrBuffer> vertexBuffer;
diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/GrFillRRectOp.cpp
index a965055..6251a79 100644
--- a/src/gpu/ops/GrFillRRectOp.cpp
+++ b/src/gpu/ops/GrFillRRectOp.cpp
@@ -53,7 +53,7 @@
         }
     }
 
-    void onPrepareDraws(Target*) final;
+    void onPrepareDraws(GrMeshDrawTarget*) final;
 
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) final;
 
@@ -457,7 +457,7 @@
 
 GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
 
-void FillRRectOp::onPrepareDraws(Target* target) {
+void FillRRectOp::onPrepareDraws(GrMeshDrawTarget* target) {
     // We request no multisample, but some platforms don't support disabling it on MSAA targets.
     if (target->usesMSAASurface() && !target->caps().multisampleDisableSupport()) {
         fProcessorFlags |= ProcessorFlags::kMSAAEnabled;
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index 555654f..a0e8405 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -256,7 +256,7 @@
         }
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         TRACE_EVENT0("skia.gpu", TRACE_FUNC);
 
         const VertexSpec vertexSpec = this->vertexSpec();
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 6fd6371..1528f4a 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -218,7 +218,7 @@
                                                                    &GrUserStencilSettings::kUnused);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
diff --git a/src/gpu/ops/GrMeshDrawOp.cpp b/src/gpu/ops/GrMeshDrawOp.cpp
index 0e2e923..da42d40 100644
--- a/src/gpu/ops/GrMeshDrawOp.cpp
+++ b/src/gpu/ops/GrMeshDrawOp.cpp
@@ -16,7 +16,7 @@
 
 void GrMeshDrawOp::onPrepare(GrOpFlushState* state) { this->onPrepareDraws(state); }
 
-void GrMeshDrawOp::createProgramInfo(Target* target) {
+void GrMeshDrawOp::createProgramInfo(GrMeshDrawTarget* target) {
     this->createProgramInfo(&target->caps(),
                             target->allocator(),
                             target->writeView(),
@@ -52,7 +52,7 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-GrMeshDrawOp::PatternHelper::PatternHelper(Target* target, GrPrimitiveType primitiveType,
+GrMeshDrawOp::PatternHelper::PatternHelper(GrMeshDrawTarget* target, GrPrimitiveType primitiveType,
                                            size_t vertexStride, sk_sp<const GrBuffer> indexBuffer,
                                            int verticesPerRepetition, int indicesPerRepetition,
                                            int repeatCount, int maxRepetitions) {
@@ -60,7 +60,7 @@
                indicesPerRepetition, repeatCount, maxRepetitions);
 }
 
-void GrMeshDrawOp::PatternHelper::init(Target* target, GrPrimitiveType primitiveType,
+void GrMeshDrawOp::PatternHelper::init(GrMeshDrawTarget* target, GrPrimitiveType primitiveType,
                                        size_t vertexStride, sk_sp<const GrBuffer> indexBuffer,
                                        int verticesPerRepetition, int indicesPerRepetition,
                                        int repeatCount, int maxRepetitions) {
@@ -87,12 +87,13 @@
                                firstVertex);
 }
 
-void GrMeshDrawOp::PatternHelper::recordDraw(Target* target, const GrGeometryProcessor* gp) const {
+void GrMeshDrawOp::PatternHelper::recordDraw(GrMeshDrawTarget* target,
+                                             const GrGeometryProcessor* gp) const {
     target->recordDraw(gp, fMesh, 1, fPrimitiveType);
 }
 
 void GrMeshDrawOp::PatternHelper::recordDraw(
-        Target* target,
+        GrMeshDrawTarget* target,
         const GrGeometryProcessor* gp,
         const GrSurfaceProxy* const primProcProxies[]) const {
     target->recordDraw(gp, fMesh, 1, primProcProxies, fPrimitiveType);
@@ -100,7 +101,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-GrMeshDrawOp::QuadHelper::QuadHelper(Target* target, size_t vertexStride, int quadsToDraw) {
+GrMeshDrawOp::QuadHelper::QuadHelper(GrMeshDrawTarget* target,
+                                     size_t vertexStride,
+                                     int quadsToDraw) {
     sk_sp<const GrGpuBuffer> indexBuffer = target->resourceProvider()->refNonAAQuadIndexBuffer();
     if (!indexBuffer) {
         SkDebugf("Could not get quad index buffer.");
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index cbb33a5..196adeb 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -8,28 +8,25 @@
 #ifndef GrMeshDrawOp_DEFINED
 #define GrMeshDrawOp_DEFINED
 
-#include "src/core/SkArenaAlloc.h"
 #include "src/gpu/GrAppliedClip.h"
-#include "src/gpu/GrDrawIndirectCommand.h"
 #include "src/gpu/GrGeometryProcessor.h"
-#include "src/gpu/GrSimpleMesh.h"
 #include "src/gpu/ops/GrDrawOp.h"
 #include <type_traits>
 
+class SkArenaAlloc;
 class GrAtlasManager;
 class GrCaps;
-class GrStrikeCache;
+class GrMeshDrawTarget;
 class GrOpFlushState;
+struct GrSimpleMesh;
 class GrSmallPathAtlasMgr;
+class GrStrikeCache;
 
 /**
  * Base class for mesh-drawing GrDrawOps.
  */
 class GrMeshDrawOp : public GrDrawOp {
 public:
-    /** Abstract interface that represents a destination for a GrMeshDrawOp. */
-    class Target;
-
     static bool CanUpgradeAAOnMerge(GrAAType aa1, GrAAType aa2) {
         return (aa1 == GrAAType::kNone && aa2 == GrAAType::kCoverage) ||
                (aa1 == GrAAType::kCoverage && aa2 == GrAAType::kNone);
@@ -49,19 +46,19 @@
                                   renderPassXferBarriers, colorLoadOp);
     }
 
-    void createProgramInfo(Target* target);
+    void createProgramInfo(GrMeshDrawTarget*);
 
     /** Helper for rendering repeating meshes using a patterned index buffer. This class creates the
-        space for the vertices and flushes the draws to the GrMeshDrawOp::Target. */
+        space for the vertices and flushes the draws to the GrMeshDrawTarget. */
     class PatternHelper {
     public:
-        PatternHelper(Target*, GrPrimitiveType, size_t vertexStride,
+        PatternHelper(GrMeshDrawTarget*, GrPrimitiveType, size_t vertexStride,
                       sk_sp<const GrBuffer> indexBuffer, int verticesPerRepetition,
                       int indicesPerRepetition, int repeatCount, int maxRepetitions);
 
-        /** Called to issue draws to the GrMeshDrawOp::Target.*/
-        void recordDraw(Target*, const GrGeometryProcessor*) const;
-        void recordDraw(Target*, const GrGeometryProcessor*,
+        /** Called to issue draws to the GrMeshDrawTarget.*/
+        void recordDraw(GrMeshDrawTarget*, const GrGeometryProcessor*) const;
+        void recordDraw(GrMeshDrawTarget*, const GrGeometryProcessor*,
                         const GrSurfaceProxy* const primProcProxies[]) const;
 
         void* vertices() const { return fVertices; }
@@ -69,9 +66,9 @@
 
     protected:
         PatternHelper() = default;
-        void init(Target*, GrPrimitiveType, size_t vertexStride, sk_sp<const GrBuffer> indexBuffer,
-                  int verticesPerRepetition, int indicesPerRepetition, int repeatCount,
-                  int maxRepetitions);
+        void init(GrMeshDrawTarget*, GrPrimitiveType, size_t vertexStride,
+                  sk_sp<const GrBuffer> indexBuffer, int verticesPerRepetition,
+                  int indicesPerRepetition, int repeatCount, int maxRepetitions);
 
     private:
         void* fVertices = nullptr;
@@ -85,7 +82,7 @@
     class QuadHelper : private PatternHelper {
     public:
         QuadHelper() = delete;
-        QuadHelper(Target* target, size_t vertexStride, int quadsToDraw);
+        QuadHelper(GrMeshDrawTarget*, size_t vertexStride, int quadsToDraw);
 
         using PatternHelper::mesh;
         using PatternHelper::recordDraw;
@@ -134,126 +131,8 @@
     }
     void onPrepare(GrOpFlushState* state) final;
 
-    virtual void onPrepareDraws(Target*) = 0;
+    virtual void onPrepareDraws(GrMeshDrawTarget*) = 0;
     using INHERITED = GrDrawOp;
 };
 
-class GrMeshDrawOp::Target {
-public:
-    virtual ~Target() {}
-
-    /** Adds a draw of a mesh. 'primProcProxies' must have
-     * GrGeometryProcessor::numTextureSamplers() entries. Can be null if no samplers.
-     */
-    virtual void recordDraw(const GrGeometryProcessor*,
-                            const GrSimpleMesh[],
-                            int meshCnt,
-                            const GrSurfaceProxy* const primProcProxies[],
-                            GrPrimitiveType) = 0;
-
-    /**
-     * Helper for drawing GrSimpleMesh(es) with zero primProc textures.
-     */
-    void recordDraw(const GrGeometryProcessor* gp,
-                    const GrSimpleMesh meshes[],
-                    int meshCnt,
-                    GrPrimitiveType primitiveType) {
-        this->recordDraw(gp, meshes, meshCnt, nullptr, primitiveType);
-    }
-
-    /**
-     * Makes space for vertex data. The returned pointer is the location where vertex data
-     * should be written. On return the buffer that will hold the data as well as an offset into
-     * the buffer (in 'vertexSize' units) where the data will be placed.
-     */
-    virtual void* makeVertexSpace(size_t vertexSize, int vertexCount, sk_sp<const GrBuffer>*,
-                                  int* startVertex) = 0;
-
-    /**
-     * Makes space for index data. The returned pointer is the location where index data
-     * should be written. On return the buffer that will hold the data as well as an offset into
-     * the buffer (in uint16_t units) where the data will be placed.
-     */
-    virtual uint16_t* makeIndexSpace(int indexCount, sk_sp<const GrBuffer>*, int* startIndex) = 0;
-
-    /**
-     * This is similar to makeVertexSpace. It allows the caller to use up to 'actualVertexCount'
-     * vertices in the returned pointer, which may exceed 'minVertexCount'.
-     * 'fallbackVertexCount' is the maximum number of vertices that should be allocated if a new
-     * buffer is allocated on behalf of this request.
-     */
-    virtual void* makeVertexSpaceAtLeast(size_t vertexSize, int minVertexCount,
-                                         int fallbackVertexCount, sk_sp<const GrBuffer>*,
-                                         int* startVertex, int* actualVertexCount) = 0;
-
-    /**
-     * This is similar to makeIndexSpace. It allows the caller to use up to 'actualIndexCount'
-     * indices in the returned pointer, which may exceed 'minIndexCount'.
-     * 'fallbackIndexCount' is the maximum number of indices that should be allocated if a new
-     * buffer is allocated on behalf of this request.
-     */
-    virtual uint16_t* makeIndexSpaceAtLeast(int minIndexCount, int fallbackIndexCount,
-                                            sk_sp<const GrBuffer>*, int* startIndex,
-                                            int* actualIndexCount) = 0;
-
-    /**
-     * Makes space for elements in a draw-indirect buffer. Upon success, the returned pointer is a
-     * CPU mapping where the data should be written.
-     */
-    virtual GrDrawIndirectWriter makeDrawIndirectSpace(int drawCount, sk_sp<const GrBuffer>* buffer,
-                                                       size_t* offsetInBytes) = 0;
-
-    /**
-     * Makes space for elements in a draw-indexed-indirect buffer. Upon success, the returned
-     * pointer is a CPU mapping where the data should be written.
-     */
-    virtual GrDrawIndexedIndirectWriter makeDrawIndexedIndirectSpace(int drawCount,
-                                                                     sk_sp<const GrBuffer>*,
-                                                                     size_t* offsetInBytes) = 0;
-
-    /** Helpers for ops which over-allocate and then return excess data to the pool. */
-    virtual void putBackIndices(int indices) = 0;
-    virtual void putBackVertices(int vertices, size_t vertexStride) = 0;
-    virtual void putBackIndirectDraws(int count) = 0;
-    virtual void putBackIndexedIndirectDraws(int count) = 0;
-
-    GrSimpleMesh* allocMesh() { return this->allocator()->make<GrSimpleMesh>(); }
-    GrSimpleMesh* allocMeshes(int n) { return this->allocator()->makeArray<GrSimpleMesh>(n); }
-    const GrSurfaceProxy** allocPrimProcProxyPtrs(int n) {
-        return this->allocator()->makeArray<const GrSurfaceProxy*>(n);
-    }
-
-    virtual GrRenderTargetProxy* rtProxy() const = 0;
-    virtual const GrSurfaceProxyView& writeView() const = 0;
-
-    virtual const GrAppliedClip* appliedClip() const = 0;
-    virtual GrAppliedClip detachAppliedClip() = 0;
-
-    virtual const GrDstProxyView& dstProxyView() const = 0;
-    virtual bool usesMSAASurface() const = 0;
-
-    virtual GrXferBarrierFlags renderPassBarriers() const = 0;
-
-    virtual GrLoadOp colorLoadOp() const = 0;
-
-    virtual GrThreadSafeCache* threadSafeCache() const = 0;
-    virtual GrResourceProvider* resourceProvider() const = 0;
-    uint32_t contextUniqueID() const { return this->resourceProvider()->contextUniqueID(); }
-
-    virtual GrStrikeCache* strikeCache() const = 0;
-    virtual GrAtlasManager* atlasManager() const = 0;
-    virtual GrSmallPathAtlasMgr* smallPathAtlasManager() const = 0;
-
-    // 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<GrSurfaceProxy*, true>* sampledProxyArray() = 0;
-
-    virtual const GrCaps& caps() const = 0;
-
-    virtual GrDeferredUploadTarget* deferredUploadTarget() = 0;
-
-    virtual SkArenaAlloc* allocator() = 0;
-};
-
 #endif
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 843b54d..8d29f16 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1293,7 +1293,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
@@ -1655,7 +1655,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
@@ -1986,7 +1986,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
@@ -2258,7 +2258,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
         }
@@ -2662,7 +2662,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
@@ -2983,7 +2983,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.cpp b/src/gpu/ops/GrQuadPerEdgeAA.cpp
index 8133422..307eb0a 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.cpp
+++ b/src/gpu/ops/GrQuadPerEdgeAA.cpp
@@ -8,6 +8,7 @@
 #include "src/gpu/ops/GrQuadPerEdgeAA.h"
 
 #include "include/private/SkVx.h"
+#include "src/gpu/GrMeshDrawTarget.h"
 #include "src/gpu/SkGr.h"
 #include "src/gpu/geometry/GrQuadUtils.h"
 #include "src/gpu/glsl/GrGLSLColorSpaceXformHelper.h"
@@ -398,7 +399,7 @@
     }
 }
 
-sk_sp<const GrBuffer> GetIndexBuffer(GrMeshDrawOp::Target* target,
+sk_sp<const GrBuffer> GetIndexBuffer(GrMeshDrawTarget* target,
                                      IndexBufferOption indexBufferOption) {
     auto resourceProvider = target->resourceProvider();
 
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.h b/src/gpu/ops/GrQuadPerEdgeAA.h
index 2445139..ffcaf8c 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.h
+++ b/src/gpu/ops/GrQuadPerEdgeAA.h
@@ -17,11 +17,11 @@
 #include "src/gpu/GrVertexWriter.h"
 #include "src/gpu/geometry/GrQuad.h"
 #include "src/gpu/geometry/GrQuadUtils.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
 #include "src/gpu/ops/GrTextureOp.h"
 
 class GrCaps;
 class GrColorSpaceXform;
+class GrMeshDrawTarget;
 class GrShaderCaps;
 struct GrVertexWriter;
 
@@ -178,7 +178,7 @@
 
     // This method will return the correct index buffer for the specified indexBufferOption.
     // It will, correctly, return nullptr if the indexBufferOption is kTriStrips.
-    sk_sp<const GrBuffer> GetIndexBuffer(GrMeshDrawOp::Target*, IndexBufferOption);
+    sk_sp<const GrBuffer> GetIndexBuffer(GrMeshDrawTarget*, IndexBufferOption);
 
     // What is the maximum number of quads allowed for the specified indexBuffer option?
     int QuadLimit(IndexBufferOption);
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index e8947b8..4615fef 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -102,7 +102,7 @@
                                                             renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
             if (!fProgramInfo) {
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index 707a824..b48329d 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -546,7 +546,7 @@
                                                                    &GrUserStencilSettings::kUnused);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         int instanceCount = fGeoData.count();
 
         sk_sp<const GrBuffer> vertexBuffer;
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 83d65d8..c2eee7d 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -186,7 +186,7 @@
         // TODO [PI]: implement
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         int instanceCount = fShapes.count();
 
         GrSmallPathAtlasMgr* atlasMgr = target->smallPathAtlasManager();
@@ -363,7 +363,7 @@
         this->flush(target, &flushInfo);
     }
 
-    bool addToAtlasWithRetry(GrMeshDrawOp::Target* target,
+    bool addToAtlasWithRetry(GrMeshDrawTarget* target,
                              FlushInfo* flushInfo,
                              GrSmallPathAtlasMgr* atlasMgr,
                              int width, int height, const void* image,
@@ -391,7 +391,7 @@
         return GrDrawOpAtlas::ErrorCode::kSucceeded == code;
     }
 
-    bool addDFPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo,
+    bool addDFPathToAtlas(GrMeshDrawTarget* target, FlushInfo* flushInfo,
                           GrSmallPathAtlasMgr* atlasMgr, GrSmallPathShapeData* shapeData,
                           const GrStyledShape& shape, uint32_t dimension, SkScalar scale) const {
 
@@ -483,7 +483,7 @@
                                          drawBounds, SK_DistanceFieldPad, shapeData);
     }
 
-    bool addBMPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo,
+    bool addBMPathToAtlas(GrMeshDrawTarget* target, FlushInfo* flushInfo,
                           GrSmallPathAtlasMgr* atlasMgr, GrSmallPathShapeData* shapeData,
                           const GrStyledShape& shape, const SkMatrix& ctm) const {
         const SkRect& bounds = shape.bounds();
@@ -574,7 +574,7 @@
         }
     }
 
-    void flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
+    void flush(GrMeshDrawTarget* target, FlushInfo* flushInfo) const {
         GrSmallPathAtlasMgr* atlasMgr = target->smallPathAtlasManager();
         if (!atlasMgr) {
             return;
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index d8eeab5..b120195 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -195,7 +195,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
         }
@@ -445,7 +445,7 @@
                              GrXferBarrierFlags renderPassXferBarriers,
                              GrLoadOp colorLoadOp) override;
 
-    void onPrepareDraws(Target*) override;
+    void onPrepareDraws(GrMeshDrawTarget*) override;
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 
 #if GR_TEST_UTILS
@@ -543,7 +543,7 @@
                                              colorLoadOp);
 }
 
-void AAStrokeRectOp::onPrepareDraws(Target* target) {
+void AAStrokeRectOp::onPrepareDraws(GrMeshDrawTarget* target) {
 
     if (!fProgramInfo) {
         this->createProgramInfo(target);
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 7c9eabc..c1c8a46 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -865,7 +865,7 @@
     }
 
     // onPrePrepareDraws may or may not have been called at this point
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         TRACE_EVENT0("skia.gpu", TRACE_FUNC);
 
         SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/ops/GrTriangulatingPathRenderer.cpp b/src/gpu/ops/GrTriangulatingPathRenderer.cpp
index 3bc5e6c..b924238 100644
--- a/src/gpu/ops/GrTriangulatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTriangulatingPathRenderer.cpp
@@ -320,7 +320,7 @@
         return GrTriangulator::PathToTriangles(path, tol, clipBounds, allocator, isLinear);
     }
 
-    void createNonAAMesh(Target* target) {
+    void createNonAAMesh(GrMeshDrawTarget* target) {
         SkASSERT(!fAntiAlias);
         GrResourceProvider* rp = target->resourceProvider();
         auto threadSafeCache = target->threadSafeCache();
@@ -387,7 +387,7 @@
         fMesh = CreateMesh(target, fVertexData->refGpuBuffer(), 0, fVertexData->numVertices());
     }
 
-    void createAAMesh(Target* target) {
+    void createAAMesh(GrMeshDrawTarget* target) {
         SkASSERT(!fVertexData);
         SkASSERT(fAntiAlias);
         SkPath path = this->getPath();
@@ -527,7 +527,7 @@
         }
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (fAntiAlias) {
             this->createAAMesh(target);
         } else {
@@ -535,8 +535,10 @@
         }
     }
 
-    static GrSimpleMesh* CreateMesh(Target* target, sk_sp<const GrBuffer> vb,
-                                    int firstVertex, int count) {
+    static GrSimpleMesh* CreateMesh(GrMeshDrawTarget* target,
+                                    sk_sp<const GrBuffer> vb,
+                                    int firstVertex,
+                                    int count) {
         auto mesh = target->allocMesh();
         mesh->set(std::move(vb), count, firstVertex);
         return mesh;
diff --git a/src/gpu/tessellate/GrPathCurveTessellator.cpp b/src/gpu/tessellate/GrPathCurveTessellator.cpp
index 479bfd8..cc0b026 100644
--- a/src/gpu/tessellate/GrPathCurveTessellator.cpp
+++ b/src/gpu/tessellate/GrPathCurveTessellator.cpp
@@ -155,7 +155,7 @@
     });
 }
 
-void GrPathCurveTessellator::prepare(GrMeshDrawOp::Target* target, const SkRect& cullBounds,
+void GrPathCurveTessellator::prepare(GrMeshDrawTarget* target, const SkRect& cullBounds,
                                      const SkPath& path,
                                      const BreadcrumbTriangleList* breadcrumbTriangleList) {
     SkASSERT(fVertexChunkArray.empty());
diff --git a/src/gpu/tessellate/GrPathCurveTessellator.h b/src/gpu/tessellate/GrPathCurveTessellator.h
index 1132fa7..37cae12 100644
--- a/src/gpu/tessellate/GrPathCurveTessellator.h
+++ b/src/gpu/tessellate/GrPathCurveTessellator.h
@@ -11,6 +11,9 @@
 #include "src/gpu/GrVertexChunkArray.h"
 #include "src/gpu/tessellate/GrPathTessellator.h"
 
+class GrCaps;
+class GrPipeline;
+
 // Draws an array of "outer curve" patches and, optionally, inner fan triangles for
 // GrCubicTessellateShader. Each patch is an independent 4-point curve, representing either a cubic
 // or a conic. Quadratics are converted to cubics and triangles are converted to conics with w=Inf.
@@ -28,7 +31,7 @@
                                    DrawInnerFan, int numPathVerbs, const GrPipeline&,
                                    const GrCaps&);
 
-    void prepare(GrMeshDrawOp::Target*, const SkRect& cullBounds, const SkPath&,
+    void prepare(GrMeshDrawTarget*, const SkRect& cullBounds, const SkPath&,
                  const BreadcrumbTriangleList*) override;
     void draw(GrOpFlushState*) const override;
     void drawHullInstances(GrOpFlushState*) const override;
diff --git a/src/gpu/tessellate/GrPathTessellator.h b/src/gpu/tessellate/GrPathTessellator.h
index 144713f..b47f0f1 100644
--- a/src/gpu/tessellate/GrPathTessellator.h
+++ b/src/gpu/tessellate/GrPathTessellator.h
@@ -12,9 +12,10 @@
 #include "src/gpu/GrInnerFanTriangulator.h"
 #include "src/gpu/GrVertexWriter.h"
 #include "src/gpu/GrVx.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
 
 class SkPath;
+class GrMeshDrawTarget;
+class GrOpFlushState;
 class GrPathTessellationShader;
 
 // Prepares GPU data for, and then draws a path's tessellated geometry. Depending on the subclass,
@@ -35,7 +36,7 @@
     // Called before draw(). Prepares GPU buffers containing the geometry to tessellate. If the
     // given BreadcrumbTriangleList is non-null, then this class will also include the breadcrumb
     // triangles in its draw.
-    virtual void prepare(GrMeshDrawOp::Target*, const SkRect& cullBounds, const SkPath&,
+    virtual void prepare(GrMeshDrawTarget*, const SkRect& cullBounds, const SkPath&,
                          const BreadcrumbTriangleList* = nullptr) = 0;
 
     // Issues draw calls for the tessellated geometry. The caller is responsible for binding its
diff --git a/src/gpu/tessellate/GrPathWedgeTessellator.cpp b/src/gpu/tessellate/GrPathWedgeTessellator.cpp
index cd5a7bd..515776d 100644
--- a/src/gpu/tessellate/GrPathWedgeTessellator.cpp
+++ b/src/gpu/tessellate/GrPathWedgeTessellator.cpp
@@ -244,7 +244,7 @@
     });
 }
 
-void GrPathWedgeTessellator::prepare(GrMeshDrawOp::Target* target, const SkRect& cullBounds,
+void GrPathWedgeTessellator::prepare(GrMeshDrawTarget* target, const SkRect& cullBounds,
                                      const SkPath& path,
                                      const BreadcrumbTriangleList* breadcrumbTriangleList) {
     SkASSERT(!breadcrumbTriangleList);
diff --git a/src/gpu/tessellate/GrPathWedgeTessellator.h b/src/gpu/tessellate/GrPathWedgeTessellator.h
index 660be63..9933cb5 100644
--- a/src/gpu/tessellate/GrPathWedgeTessellator.h
+++ b/src/gpu/tessellate/GrPathWedgeTessellator.h
@@ -11,6 +11,9 @@
 #include "src/gpu/GrVertexChunkArray.h"
 #include "src/gpu/tessellate/GrPathTessellator.h"
 
+class GrCaps;
+class GrPipeline;
+
 // Prepares an array of "wedge" patches for GrWedgeTessellateShader. A wedge is an independent,
 // 5-point closed contour consisting of 4 control points plus an anchor point fanning from the
 // center of the curve's resident contour. A wedge can be either a cubic or a conic. Quadratics and
@@ -21,7 +24,7 @@
     static GrPathTessellator* Make(SkArenaAlloc*, const SkMatrix& viewMatrix, const SkPMColor4f&,
                                    int numPathVerbs, const GrPipeline&, const GrCaps&);
 
-    void prepare(GrMeshDrawOp::Target*, const SkRect& cullBounds, const SkPath&,
+    void prepare(GrMeshDrawTarget*, const SkRect& cullBounds, const SkPath&,
                  const BreadcrumbTriangleList*) override;
     void draw(GrOpFlushState*) const override;
 
diff --git a/src/gpu/tessellate/GrStrokeFixedCountTessellator.cpp b/src/gpu/tessellate/GrStrokeFixedCountTessellator.cpp
index ead4556..e28c3eb 100644
--- a/src/gpu/tessellate/GrStrokeFixedCountTessellator.cpp
+++ b/src/gpu/tessellate/GrStrokeFixedCountTessellator.cpp
@@ -25,7 +25,7 @@
 public:
     using ShaderFlags = GrStrokeTessellator::ShaderFlags;
 
-    InstanceWriter(ShaderFlags shaderFlags, GrMeshDrawOp::Target* target, float matrixMaxScale,
+    InstanceWriter(ShaderFlags shaderFlags, GrMeshDrawTarget* target, float matrixMaxScale,
                    const SkRect& strokeCullBounds, const SkMatrix& viewMatrix,
                    GrVertexChunkArray* patchChunks, size_t instanceStride, int minInstancesPerChunk)
             : fShaderFlags(shaderFlags)
@@ -244,7 +244,7 @@
                               matrixMinMaxScales, strokeCullBounds) {
 }
 
-void GrStrokeFixedCountTessellator::prepare(GrMeshDrawOp::Target* target,
+void GrStrokeFixedCountTessellator::prepare(GrMeshDrawTarget* target,
                                             int totalCombinedVerbCnt) {
     int maxEdgesInJoin = 0;
     float maxRadialSegmentsPerRadian = 0;
diff --git a/src/gpu/tessellate/GrStrokeFixedCountTessellator.h b/src/gpu/tessellate/GrStrokeFixedCountTessellator.h
index ce708f8..d7498e5 100644
--- a/src/gpu/tessellate/GrStrokeFixedCountTessellator.h
+++ b/src/gpu/tessellate/GrStrokeFixedCountTessellator.h
@@ -19,7 +19,7 @@
                                   std::array<float,2> matrixMinMaxScales,
                                   const SkRect& strokeCullBounds);
 
-    void prepare(GrMeshDrawOp::Target*, int totalCombinedVerbCnt) override;
+    void prepare(GrMeshDrawTarget*, int totalCombinedVerbCnt) override;
     void draw(GrOpFlushState*) const override;
 
 private:
diff --git a/src/gpu/tessellate/GrStrokeHardwareTessellator.cpp b/src/gpu/tessellate/GrStrokeHardwareTessellator.cpp
index 88e0287..a4d95f7 100644
--- a/src/gpu/tessellate/GrStrokeHardwareTessellator.cpp
+++ b/src/gpu/tessellate/GrStrokeHardwareTessellator.cpp
@@ -51,7 +51,7 @@
         kBowtie = SkPaint::kLast_Join + 1  // Double sided round join.
     };
 
-    PatchWriter(ShaderFlags shaderFlags, GrMeshDrawOp::Target* target,
+    PatchWriter(ShaderFlags shaderFlags, GrMeshDrawTarget* target,
                 const SkRect& strokeCullBounds, const SkMatrix& viewMatrix, float matrixMaxScale,
                 GrVertexChunkArray* patchChunks, size_t patchStride, int minPatchesPerChunk)
             : fShaderFlags(shaderFlags)
@@ -702,7 +702,7 @@
 
 }  // namespace
 
-void GrStrokeHardwareTessellator::prepare(GrMeshDrawOp::Target* target, int totalCombinedVerbCnt) {
+void GrStrokeHardwareTessellator::prepare(GrMeshDrawTarget* target, int totalCombinedVerbCnt) {
     using JoinType = PatchWriter::JoinType;
 
     // Over-allocate enough patches for 1 in 4 strokes to chop and for 8 extra caps.
diff --git a/src/gpu/tessellate/GrStrokeHardwareTessellator.h b/src/gpu/tessellate/GrStrokeHardwareTessellator.h
index 4204f2f..ccd76fc 100644
--- a/src/gpu/tessellate/GrStrokeHardwareTessellator.h
+++ b/src/gpu/tessellate/GrStrokeHardwareTessellator.h
@@ -26,7 +26,7 @@
                                   strokeCullBounds) {
     }
 
-    void prepare(GrMeshDrawOp::Target*, int totalCombinedVerbCnt) override;
+    void prepare(GrMeshDrawTarget*, int totalCombinedVerbCnt) override;
     void draw(GrOpFlushState*) const override;
 
 private:
diff --git a/src/gpu/tessellate/GrStrokeTessellateOp.h b/src/gpu/tessellate/GrStrokeTessellateOp.h
index b873995..df310b8 100644
--- a/src/gpu/tessellate/GrStrokeTessellateOp.h
+++ b/src/gpu/tessellate/GrStrokeTessellateOp.h
@@ -9,7 +9,7 @@
 #define GrStrokeTessellateOp_DEFINED
 
 #include "include/core/SkStrokeRec.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
+#include "src/gpu/ops/GrDrawOp.h"
 #include "src/gpu/tessellate/GrStrokeTessellator.h"
 #include "src/gpu/tessellate/shaders/GrTessellationShader.h"
 
diff --git a/src/gpu/tessellate/GrStrokeTessellator.h b/src/gpu/tessellate/GrStrokeTessellator.h
index 42fbf27..f7e93df 100644
--- a/src/gpu/tessellate/GrStrokeTessellator.h
+++ b/src/gpu/tessellate/GrStrokeTessellator.h
@@ -40,7 +40,7 @@
     const GrTessellationShader* shader() const { return &fShader; }
 
     // Called before draw(). Prepares GPU buffers containing the geometry to tessellate.
-    virtual void prepare(GrMeshDrawOp::Target*, int totalCombinedVerbCnt) = 0;
+    virtual void prepare(GrMeshDrawTarget*, int totalCombinedVerbCnt) = 0;
 
     // Issues draw calls for the tessellated stroke. The caller is responsible for creating and
     // binding a pipeline that uses this class's shader() before calling draw().
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 8cb00bd..828a146 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -320,7 +320,7 @@
             int begin, int end,
             GrMaskFormat maskFormat,
             int srcPadding,
-            GrMeshDrawOp::Target *target,
+            GrMeshDrawTarget *,
             bool bilerpPadding = false);
 
     static size_t GlyphVectorSize(size_t count) {
@@ -367,7 +367,7 @@
 std::tuple<bool, int> GlyphVector::regenerateAtlas(int begin, int end,
                                                    GrMaskFormat maskFormat,
                                                    int srcPadding,
-                                                   GrMeshDrawOp::Target* target,
+                                                   GrMeshDrawTarget* target,
                                                    bool bilerpPadding) {
     GrAtlasManager* atlasManager = target->atlasManager();
     GrDeferredUploadTarget* uploadTarget = target->deferredUploadTarget();
@@ -472,7 +472,7 @@
     void testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) override;
 
     std::tuple<bool, int>
-    regenerateAtlas(int begin, int end, GrMeshDrawOp::Target* target) const override;
+    regenerateAtlas(int begin, int end, GrMeshDrawTarget*) const override;
 
     void fillVertexData(void* vertexDst, int offset, int count, GrColor color,
                         const SkMatrix& positionMatrix, SkIRect clip) const override;
@@ -693,7 +693,7 @@
 }
 
 std::tuple<bool, int>
-DirectMaskSubRun::regenerateAtlas(int begin, int end, GrMeshDrawOp::Target* target) const {
+DirectMaskSubRun::regenerateAtlas(int begin, int end, GrMeshDrawTarget* target) const {
     return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, 0, target);
 }
 
@@ -859,8 +859,7 @@
 
     void testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) override;
 
-    std::tuple<bool, int> regenerateAtlas(
-            int begin, int end, GrMeshDrawOp::Target* target) const override;
+    std::tuple<bool, int> regenerateAtlas(int begin, int end, GrMeshDrawTarget*) const override;
 
     void fillVertexData(
             void* vertexDst, int offset, int count,
@@ -987,7 +986,7 @@
 }
 
 std::tuple<bool, int> TransformedMaskSubRun::regenerateAtlas(int begin, int end,
-                                                             GrMeshDrawOp::Target* target) const {
+                                                             GrMeshDrawTarget* target) const {
     return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, 1, target, true);
 }
 
@@ -1115,8 +1114,7 @@
 
     void testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) override;
 
-    std::tuple<bool, int> regenerateAtlas(
-            int begin, int end, GrMeshDrawOp::Target* target) const override;
+    std::tuple<bool, int> regenerateAtlas(int begin, int end, GrMeshDrawTarget*) const override;
 
     void fillVertexData(
             void* vertexDst, int offset, int count,
@@ -1301,7 +1299,7 @@
 }
 
 std::tuple<bool, int> SDFTSubRun::regenerateAtlas(
-        int begin, int end, GrMeshDrawOp::Target *target) const {
+        int begin, int end, GrMeshDrawTarget *target) const {
 
     return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, SK_DistanceFieldInset, target);
 }
@@ -1662,7 +1660,7 @@
     void testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) override;
 
     std::tuple<bool, int>
-    regenerateAtlas(int begin, int end, GrMeshDrawOp::Target* target) const override;
+    regenerateAtlas(int begin, int end, GrMeshDrawTarget*) const override;
 
     void fillVertexData(void* vertexDst, int offset, int count, GrColor color,
                         const SkMatrix& positionMatrix, SkIRect clip) const override;
@@ -1812,7 +1810,7 @@
 }
 
 std::tuple<bool, int>
-DirectMaskSubRunNoCache::regenerateAtlas(int begin, int end, GrMeshDrawOp::Target* target) const {
+DirectMaskSubRunNoCache::regenerateAtlas(int begin, int end, GrMeshDrawTarget* target) const {
     return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, 0, target);
 }
 
@@ -1896,8 +1894,7 @@
 
     void testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) override;
 
-    std::tuple<bool, int> regenerateAtlas(
-            int begin, int end, GrMeshDrawOp::Target* target) const override;
+    std::tuple<bool, int> regenerateAtlas(int begin, int end, GrMeshDrawTarget*) const override;
 
     void fillVertexData(
             void* vertexDst, int offset, int count,
@@ -2004,7 +2001,7 @@
 }
 
 std::tuple<bool, int> TransformedMaskSubRunNoCache::regenerateAtlas(
-        int begin, int end, GrMeshDrawOp::Target* target) const {
+        int begin, int end, GrMeshDrawTarget* target) const {
     return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, 1, target, true);
 }
 
@@ -2118,8 +2115,7 @@
 
     void testingOnly_packedGlyphIDToGrGlyph(GrStrikeCache *cache) override;
 
-    std::tuple<bool, int> regenerateAtlas(
-            int begin, int end, GrMeshDrawOp::Target* target) const override;
+    std::tuple<bool, int> regenerateAtlas(int begin, int end, GrMeshDrawTarget*) const override;
 
     void fillVertexData(
             void* vertexDst, int offset, int count,
@@ -2244,7 +2240,7 @@
 }
 
 std::tuple<bool, int> SDFTSubRunNoCache::regenerateAtlas(
-        int begin, int end, GrMeshDrawOp::Target *target) const {
+        int begin, int end, GrMeshDrawTarget *target) const {
 
     return fGlyphs.regenerateAtlas(begin, end, fMaskFormat, SK_DistanceFieldInset, target);
 }
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index e7d00a2..0769447 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -22,13 +22,13 @@
 #include "src/core/SkTLazy.h"
 #include "src/gpu/GrColor.h"
 #include "src/gpu/GrSubRunAllocator.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
 #include "src/gpu/ops/GrOp.h"
 
 class GrAtlasManager;
 class GrAtlasTextOp;
 class GrDeferredUploadTarget;
 class GrGlyph;
+class GrMeshDrawTarget;
 class GrStrikeCache;
 class GrSubRun;
 
@@ -80,7 +80,7 @@
     // This call is not thread safe. It should only be called from GrDrawOp::onPrepare which
     // is single threaded.
     virtual std::tuple<bool, int> regenerateAtlas(
-            int begin, int end, GrMeshDrawOp::Target* target) const = 0;
+            int begin, int end, GrMeshDrawTarget* target) const = 0;
 };
 
 // -- GrSubRun -------------------------------------------------------------------------------------
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 818bd2e..d28ba67 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -64,7 +64,7 @@
     }
     template<typename T> sk_sp<const GrBuffer> makeVertexBuffer(const T* data, int count);
 
-    GrMeshDrawOp::Target* target() { return fState; }
+    GrMeshDrawTarget* target() { return fState; }
 
     sk_sp<const GrBuffer> fIndexBuffer;
     sk_sp<const GrBuffer> fIndexBuffer2;
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index ab458d6..780b4e2 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -16,7 +16,6 @@
 #include "src/gpu/GrXferProcessor.h"
 #include "src/gpu/effects/GrPorterDuffXferProcessor.h"
 #include "src/gpu/gl/GrGLCaps.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
 #include "tools/gpu/GrContextFactory.h"
 #include "tools/gpu/ManagedBackendTexture.h"
 
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 29fb5ee..1e9167f 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -124,7 +124,7 @@
                                                  renderPassXferBarriers, colorLoadOp);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
 
         // The vertex attrib order is always pos, color, local coords.
         static const int kColorOffset = sizeof(SkPoint);
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 5b8d203..ef9604c 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -138,7 +138,7 @@
                                                                    GrPipeline::InputFlags::kNone);
     }
 
-    void onPrepareDraws(Target* target) override {
+    void onPrepareDraws(GrMeshDrawTarget* target) override {
         if (!fProgramInfo) {
             this->createProgramInfo(target);
         }
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 13f8e28..de4a33b 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -74,7 +74,7 @@
                            const GrDstProxyView&,
                            GrXferBarrierFlags renderPassXferBarriers,
                            GrLoadOp colorLoadOp) override {}
-    void onPrepareDraws(Target* target) override { return; }
+    void onPrepareDraws(GrMeshDrawTarget*) override { return; }
     void onExecute(GrOpFlushState*, const SkRect&) override { return; }
 
     GrProcessorSet fProcessors;
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index b76ce0e..c394e1b 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -26,7 +26,6 @@
 #include "src/gpu/GrTexture.h"
 #include "src/gpu/SkGr.h"
 #include "src/gpu/ccpr/GrCoverageCountingPathRenderer.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
 #include "src/gpu/text/GrStrikeCache.h"
 #include "src/gpu/text/GrTextBlobCache.h"
 #include "src/image/SkImage_Gpu.h"
diff --git a/tools/gpu/TestOps.cpp b/tools/gpu/TestOps.cpp
index 8f8a17d..427c3d9 100644
--- a/tools/gpu/TestOps.cpp
+++ b/tools/gpu/TestOps.cpp
@@ -129,7 +129,7 @@
                              GrXferBarrierFlags renderPassXferBarriers,
                              GrLoadOp colorLoadOp) override;
 
-    void onPrepareDraws(Target*) override;
+    void onPrepareDraws(GrMeshDrawTarget*) override;
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 
     SkRect         fDrawRect;
@@ -200,7 +200,7 @@
                                                                GrPipeline::InputFlags::kNone);
 }
 
-void TestRectOp::onPrepareDraws(Target* target) {
+void TestRectOp::onPrepareDraws(GrMeshDrawTarget* target) {
     QuadHelper helper(target, fGP.vertexStride(), 1);
     GrVertexWriter writer{helper.vertices()};
     auto pos = GrVertexWriter::TriStripFromRect(fDrawRect);
diff --git a/tools/gpu/TestOps.h b/tools/gpu/TestOps.h
index 7f7af01..0f83761 100644
--- a/tools/gpu/TestOps.h
+++ b/tools/gpu/TestOps.h
@@ -11,7 +11,7 @@
 #include "include/core/SkRefCnt.h"
 #include "include/gpu/GrRecordingContext.h"
 #include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/ops/GrMeshDrawOp.h"
+#include "src/gpu/ops/GrOp.h"
 
 class GrPaint;