Remove GrLegacyMeshDrawOp and GrPipelineBuilder

Change-Id: Ib301a0e7d4b4c4f05417d28862017307949748c9
Reviewed-on: https://skia-review.googlesource.com/23584
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index ae7d991..784ac8f 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -127,7 +127,6 @@
   "$_src/gpu/GrOnFlushResourceProvider.h",
   "$_src/gpu/GrPipeline.cpp",
   "$_src/gpu/GrPipeline.h",
-  "$_src/gpu/GrPipelineBuilder.h",
   "$_src/gpu/GrPrimitiveProcessor.cpp",
   "$_src/gpu/GrPrimitiveProcessor.h",
   "$_src/gpu/GrProcessorSet.cpp",
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index c277ba7..f48b8db 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -28,7 +28,6 @@
 class GrIndexBuffer;
 class GrOvalRenderer;
 class GrPath;
-class GrPipelineBuilder;
 class GrResourceEntry;
 class GrResourceCache;
 class GrResourceProvider;
diff --git a/src/gpu/GrDrawOpTest.h b/src/gpu/GrDrawOpTest.h
index 57d5afb..6dc9541 100644
--- a/src/gpu/GrDrawOpTest.h
+++ b/src/gpu/GrDrawOpTest.h
@@ -14,7 +14,6 @@
 #if GR_TEST_UTILS
 
 class GrDrawOp;
-class GrLegacyMeshDrawOp;
 class GrPaint;
 class GrRenderTargetContext;
 struct GrUserStencilSettings;
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index c55ed57..a3cf8c6 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -23,10 +23,6 @@
 
 /**
  *  Base class for drawing paths into a GrOpList.
- *
- *  Derived classes can use stages GrPaint::kTotalStages through GrPipelineBuilder::kNumStages-1.
- *  The stages before GrPaint::kTotalStages are reserved for setting up the draw (i.e., textures and
- *  filter masks).
  */
 class SK_API GrPathRenderer : public SkRefCnt {
 public:
@@ -40,11 +36,10 @@
      * rendered into the stencil.
      *
      * A GrPathRenderer can provide three levels of support for stenciling paths:
-     * 1) kNoRestriction: This is the most general. The caller sets up the GrPipelineBuilder on the
-     *                    target and calls drawPath(). The path is rendered exactly as the draw
-     *                    state indicates including support for simultaneous color and stenciling
-     *                    with arbitrary stenciling rules. Pixels partially covered by AA paths are
-     *                    affected by the stencil settings.
+     * 1) kNoRestriction: This is the most general. The caller passes a GrPaint and calls drawPath().
+     *                    The path is rendered exactly as the draw state indicates including support
+     *                    for simultaneous color and stenciling with arbitrary stenciling rules.
+     *                    Pixels partially covered by AA paths are affected by the stencil settings.
      * 2) kStencilOnly: The path renderer cannot apply arbitrary stencil rules nor shade and stencil
      *                  simultaneously. The path renderer does support the stencilPath() function
      *                  which performs no color writes and writes a non-zero stencil value to pixels
@@ -147,7 +142,7 @@
 
     /**
      * Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then
-     * the subclass must respect the stencil settings of the GrPipelineBuilder.
+     * the subclass must respect the stencil settings.
      */
     bool drawPath(const DrawPathArgs& args) {
         SkDEBUGCODE(args.validate();)
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index e54369e..0483d42 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -10,7 +10,6 @@
 #include "GrAppliedClip.h"
 #include "GrCaps.h"
 #include "GrGpu.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrRenderTargetOpList.h"
 #include "GrRenderTargetPriv.h"
@@ -50,8 +49,7 @@
         fDstTextureOffset = args.fDstProxy.offset();
     }
 
-    // Copy GrFragmentProcessors from GrPipelineBuilder to Pipeline, possibly removing some of the
-    // color fragment processors.
+    // Copy GrFragmentProcessors from GrProcessorSet to Pipeline
     fNumColorProcessors = args.fProcessors->numColorFragmentProcessors();
     int numTotalProcessors =
             fNumColorProcessors + args.fProcessors->numCoverageFragmentProcessors();
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 5d6041c..81b7923 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -29,12 +29,12 @@
 class GrAppliedClip;
 class GrDeviceCoordTexture;
 class GrOp;
-class GrPipelineBuilder;
 class GrRenderTargetContext;
 
 /**
- * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable
- * class, and contains all data needed to set the state for a gpu draw.
+ * This immutable object contains information needed to set build a shader program and set API
+ * state for a draw. It is used along with a GrPrimitiveProcessor and a source of geometric
+ * data (GrMesh or GrPath) to draw.
  */
 class GrPipeline : public GrNonAtomicRef<GrPipeline> {
 public:
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
deleted file mode 100644
index 9023e8a..0000000
--- a/src/gpu/GrPipelineBuilder.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrPipelineBuilder_DEFINED
-#define GrPipelineBuilder_DEFINED
-
-#include "GrPipeline.h"
-#include "GrProcessorSet.h"
-#include "GrUserStencilSettings.h"
-#include "GrXferProcessor.h"
-
-class GrCaps;
-class GrDrawOp;
-class GrPaint;
-class GrTexture;
-
-class GrPipelineBuilder : private SkNoncopyable {
-public:
-    /**
-     * Initializes the GrPipelineBuilder based on a GrPaint and MSAA availability. Note
-     * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have
-     * no GrPaint equivalents are set to default values with the exception of vertex attribute state
-     * which is unmodified by this function and clipping which will be enabled.
-     */
-    GrPipelineBuilder(GrPaint&& paint, GrAAType aaType)
-            : fFlags(GrPipeline::SRGBFlagsFromPaint(paint))
-            , fUserStencilSettings(&GrUserStencilSettings::kUnused)
-            , fProcessors(std::move(paint)) {
-        if (GrAATypeIsHW(aaType)) {
-            fFlags |= GrPipeline::kHWAntialias_Flag;
-        }
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// @name Fragment Processors
-    ///
-    /// GrFragmentProcessors are used to compute per-pixel color and per-pixel fractional coverage.
-    /// There are two chains of FPs, one for color and one for coverage. The first FP in each
-    /// chain gets the initial color/coverage from the GrPrimitiveProcessor. It computes an output
-    /// color/coverage which is fed to the next FP in the chain. The last color and coverage FPs
-    /// feed their output to the GrXferProcessor which controls blending.
-    ////
-
-    int numColorFragmentProcessors() const { return fProcessors.numColorFragmentProcessors(); }
-    int numCoverageFragmentProcessors() const {
-        return fProcessors.numCoverageFragmentProcessors();
-    }
-    int numFragmentProcessors() const { return fProcessors.numFragmentProcessors(); }
-
-    const GrFragmentProcessor* getColorFragmentProcessor(int idx) const {
-        return fProcessors.colorFragmentProcessor(idx);
-    }
-    const GrFragmentProcessor* getCoverageFragmentProcessor(int idx) const {
-        return fProcessors.coverageFragmentProcessor(idx);
-    }
-
-    const GrProcessorSet& processors() const { return fProcessors; }
-
-    GrProcessorSet::Analysis finalizeProcessors(const GrProcessorAnalysisColor& colorInput,
-                                                const GrProcessorAnalysisCoverage coverageInput,
-                                                const GrAppliedClip* clip, bool isMixedSamples,
-                                                const GrCaps& caps, GrColor* overrideColor) {
-        return fProcessors.finalize(colorInput, coverageInput, clip, isMixedSamples, caps,
-                                    overrideColor);
-    }
-
-    /// @}
-
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// @name Stencil
-    ////
-
-    bool hasUserStencilSettings() const { return !fUserStencilSettings->isUnused(); }
-
-    /**
-     * Sets the user stencil settings for the next draw.
-     * This class only stores pointers to stencil settings objects.
-     * The caller guarantees the pointer will remain valid until it
-     * changes or goes out of scope.
-     * @param settings  the stencil settings to use.
-     */
-    void setUserStencil(const GrUserStencilSettings* settings) { fUserStencilSettings = settings; }
-
-    /// @}
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// @name State Flags
-    ////
-
-    bool isHWAntialias() const { return SkToBool(fFlags & GrPipeline::kHWAntialias_Flag); }
-
-    void setSnapVerticesToPixelCenters(bool enable) {
-        if (enable) {
-            fFlags |= GrPipeline::kSnapVerticesToPixelCenters_Flag;
-        } else {
-            fFlags &= ~GrPipeline::kSnapVerticesToPixelCenters_Flag;
-        }
-    }
-
-    /// @}
-
-    void getPipelineInitArgs(GrPipeline::InitArgs* args) const {
-        args->fFlags = fFlags;
-        args->fUserStencil = fUserStencilSettings;
-        args->fProcessors = &fProcessors;
-    }
-
-private:
-    uint32_t fFlags;
-    const GrUserStencilSettings* fUserStencilSettings;
-    GrProcessorSet fProcessors;
-};
-
-#endif
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 6a08447..65f19e3 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -16,7 +16,6 @@
 #include "GrFixedClip.h"
 #include "GrGpuResourcePriv.h"
 #include "GrPathRenderer.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTarget.h"
 #include "GrRenderTargetContextPriv.h"
 #include "GrResourceProvider.h"
@@ -1799,69 +1798,6 @@
                                       std::move(appliedClip), dstProxy);
 }
 
-uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipelineBuilder,
-                                                    const GrClip& clip,
-                                                    std::unique_ptr<GrLegacyMeshDrawOp> op) {
-    ASSERT_SINGLE_OWNER
-    if (this->drawingManager()->wasAbandoned()) {
-        return SK_InvalidUniqueID;
-    }
-    SkDEBUGCODE(this->validate();)
-    GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "addLegacyMeshDrawOp", fContext);
-
-    // Setup clip
-    SkRect bounds;
-    op_bounds(&bounds, op.get());
-    GrAppliedClip appliedClip;
-    if (!clip.apply(fContext, this, pipelineBuilder.isHWAntialias(),
-                    pipelineBuilder.hasUserStencilSettings(), &appliedClip, &bounds)) {
-        return SK_InvalidUniqueID;
-    }
-
-    // This forces instantiation of the render target. Pipeline creation is moving to flush time
-    // by which point instantiation must have occurred anyway.
-    GrRenderTarget* rt = this->accessRenderTarget();
-    if (!rt) {
-        return SK_InvalidUniqueID;
-    }
-
-    GrResourceProvider* resourceProvider = fContext->resourceProvider();
-    bool usesStencil = pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip();
-    if (usesStencil) {
-        if (!resourceProvider->attachStencilAttachment(this->accessRenderTarget())) {
-            SkDebugf("ERROR creating stencil attachment. Draw skipped.\n");
-            return SK_InvalidUniqueID;
-        }
-    }
-
-    bool isMixedSamples = GrFSAAType::kMixedSamples == this->fsaaType() &&
-                          (pipelineBuilder.isHWAntialias() || usesStencil);
-
-    GrColor overrideColor;
-    GrProcessorSet::Analysis analysis = op->analyzeUpdateAndRecordProcessors(
-            &pipelineBuilder, &appliedClip, isMixedSamples, *this->caps(), &overrideColor);
-
-    GrPipeline::InitArgs args;
-    pipelineBuilder.getPipelineInitArgs(&args);
-    args.fAppliedClip = &appliedClip;
-    args.fRenderTarget = rt;
-    args.fCaps = this->caps();
-    args.fResourceProvider = resourceProvider;
-
-    if (analysis.requiresDstTexture()) {
-        if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, bounds, &args.fDstProxy)) {
-            return SK_InvalidUniqueID;
-        }
-    }
-    op->initPipeline(args, analysis, overrideColor);
-
-    // Add the pipeline dependencies on textures, etc before recording this op.
-    op->addDependenciesTo(this->getOpList(), *this->caps());
-
-    op->setClippedBounds(bounds);
-    return this->getRTOpList()->addOp(std::move(op), *this->caps());
-}
-
 bool GrRenderTargetContext::setupDstProxy(GrRenderTargetProxy* rtProxy, const GrClip& clip,
                                             const SkRect& opBounds,
                                             GrXferProcessor::DstProxy* dstProxy) {
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 21f9018..1958ed7 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -26,8 +26,6 @@
 class GrDrawingManager;
 class GrDrawOp;
 class GrFixedClip;
-class GrLegacyMeshDrawOp;
-class GrPipelineBuilder;
 class GrRenderTarget;
 class GrRenderTargetContextPriv;
 class GrRenderTargetOpList;
@@ -414,8 +412,6 @@
     // the op list. They return the id of the opList to which the op was added, or 0, if it was
     // dropped (e.g., due to clipping).
     uint32_t addDrawOp(const GrClip&, std::unique_ptr<GrDrawOp>);
-    uint32_t addLegacyMeshDrawOp(GrPipelineBuilder&&, const GrClip&,
-                                 std::unique_ptr<GrLegacyMeshDrawOp>);
 
     // Makes a copy of the proxy if it is necessary for the draw and places the texture that should
     // be used by GrXferProcessor to access the destination color in 'result'. If the return
diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h
index ed1b40b..b32eaed 100644
--- a/src/gpu/GrRenderTargetContextPriv.h
+++ b/src/gpu/GrRenderTargetContextPriv.h
@@ -102,11 +102,6 @@
         return fRenderTargetContext->fRenderTargetProxy->uniqueID();
     }
 
-    uint32_t testingOnly_addLegacyMeshDrawOp(GrPaint&&, GrAAType,
-                                             std::unique_ptr<GrLegacyMeshDrawOp>,
-                                             const GrUserStencilSettings* = nullptr,
-                                             bool snapToCenters = false);
-
     uint32_t testingOnly_addDrawOp(std::unique_ptr<GrDrawOp>);
 
     bool refsWrappedObjects() const {
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 7a26a05..68c4890 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -25,7 +25,6 @@
 class GrAuditTrail;
 class GrClearOp;
 class GrCaps;
-class GrPipelineBuilder;
 class GrRenderTargetProxy;
 
 namespace gr_instanced {
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 8809913..5d247fa 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -9,7 +9,6 @@
 #include "GrCaps.h"
 #include "GrContext.h"
 #include "GrContextPriv.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrShape.h"
 #include "GrSurfaceContext.h"
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index c98f1da..e171b78 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -9,7 +9,6 @@
 #include "GrAuditTrail.h"
 #include "GrClip.h"
 #include "GrGpuResourcePriv.h"
-#include "GrPipelineBuilder.h"
 #include "GrResourceProvider.h"
 #include "GrSWMaskHelper.h"
 #include "ops/GrDrawOp.h"
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index af10450..9841f70 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -15,7 +15,6 @@
 #include "GrGeometryProcessor.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
-#include "GrPipelineBuilder.h"
 #include "GrProcessor.h"
 #include "GrSimpleMeshDrawOpHelper.h"
 #include "SkGeometry.h"
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 883bc45..5d12fdf 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -14,7 +14,6 @@
 #include "GrDrawOpTest.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
-#include "GrPipelineBuilder.h"
 #include "GrProcessor.h"
 #include "GrResourceProvider.h"
 #include "GrSimpleMeshDrawOpHelper.h"
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index 9a5f5b0..356c7ac 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -13,7 +13,6 @@
 #include "GrGeometryProcessor.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
-#include "GrPipelineBuilder.h"
 #include "GrProcessor.h"
 #include "GrStyle.h"
 #include "SkGeometry.h"
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index a7b4967..8c49e6d 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -144,7 +144,7 @@
     this->flush(target, &flushInfo);
 }
 
-void GrAtlasTextOp::flush(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
+void GrAtlasTextOp::flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
     GrMesh mesh(GrPrimitiveType::kTriangles);
     int maxGlyphsPerDraw =
             static_cast<int>(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6);
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 449f1fa..3456fe0 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -150,7 +150,7 @@
                kLCDBGRDistanceField_MaskType == fMaskType;
     }
 
-    inline void flush(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo) const;
+    inline void flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const;
 
     GrColor color() const { return fColor; }
     const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
@@ -203,7 +203,7 @@
  */
 class GrBlobRegenHelper {
 public:
-    GrBlobRegenHelper(const GrAtlasTextOp* op, GrLegacyMeshDrawOp::Target* target,
+    GrBlobRegenHelper(const GrAtlasTextOp* op, GrMeshDrawOp::Target* target,
                       GrAtlasTextOp::FlushInfo* flushInfo)
             : fOp(op), fTarget(target), fFlushInfo(flushInfo) {}
 
@@ -213,7 +213,7 @@
 
 private:
     const GrAtlasTextOp* fOp;
-    GrLegacyMeshDrawOp::Target* fTarget;
+    GrMeshDrawOp::Target* fTarget;
     GrAtlasTextOp::FlushInfo* fFlushInfo;
 };
 
diff --git a/src/gpu/ops/GrDashLinePathRenderer.cpp b/src/gpu/ops/GrDashLinePathRenderer.cpp
index a364d92..38d486c 100644
--- a/src/gpu/ops/GrDashLinePathRenderer.cpp
+++ b/src/gpu/ops/GrDashLinePathRenderer.cpp
@@ -9,7 +9,6 @@
 
 #include "GrAuditTrail.h"
 #include "GrGpu.h"
-#include "GrPipelineBuilder.h"
 #include "ops/GrDashOp.h"
 #include "ops/GrMeshDrawOp.h"
 
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 565cd78..891c5a5 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -13,7 +13,6 @@
 #include "GrMesh.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
-#include "GrPipelineBuilder.h"
 #include "GrSimpleMeshDrawOpHelper.h"
 #include "SkGeometry.h"
 #include "SkString.h"
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index a49eec2..b570a65 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -14,7 +14,6 @@
 #include "GrOpFlushState.h"
 #include "GrPathStencilSettings.h"
 #include "GrPathUtils.h"
-#include "GrPipelineBuilder.h"
 #include "GrSimpleMeshDrawOpHelper.h"
 #include "SkAutoMalloc.h"
 #include "SkGeometry.h"
diff --git a/src/gpu/ops/GrMeshDrawOp.cpp b/src/gpu/ops/GrMeshDrawOp.cpp
index 48f2ea6..e42f319 100644
--- a/src/gpu/ops/GrMeshDrawOp.cpp
+++ b/src/gpu/ops/GrMeshDrawOp.cpp
@@ -95,7 +95,7 @@
     if (!op->fQueuedDraws.empty()) {
         // If the last draw shares a geometry processor and pipeline and there are no intervening
         // uploads, add this mesh to it.
-        GrLegacyMeshDrawOp::QueuedDraw& lastDraw = op->fQueuedDraws.back();
+        GrMeshDrawOp::QueuedDraw& lastDraw = op->fQueuedDraws.back();
         if (lastDraw.fGeometryProcessor == gp && lastDraw.fPipeline == pipeline &&
             (op->fInlineUploads.empty() ||
              op->fInlineUploads.back().fUploadBeforeToken != this->nextDrawToken())) {
@@ -103,7 +103,7 @@
             return;
         }
     }
-    GrLegacyMeshDrawOp::QueuedDraw& draw = op->fQueuedDraws.push_back();
+    GrMeshDrawOp::QueuedDraw& draw = op->fQueuedDraws.push_back();
     GrDrawOpUploadToken token = this->state()->issueDrawToken();
     draw.fGeometryProcessor.reset(gp);
     draw.fPipeline = pipeline;
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index df96455..916806c 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -12,7 +12,6 @@
 #include "GrGeometryProcessor.h"
 #include "GrMesh.h"
 #include "GrPendingProgramElement.h"
-#include "GrPipelineBuilder.h"
 
 #include "SkTLList.h"
 
@@ -91,132 +90,4 @@
     typedef GrDrawOp INHERITED;
 };
 
-/**
- * Many of our ops derive from this class which initializes a GrPipeline just before being recorded.
- * We are migrating away from use of this class.
- */
-class GrLegacyMeshDrawOp : public GrMeshDrawOp {
-public:
-    /**
-     * Performs analysis of the fragment processors in GrProcessorSet and GrAppliedClip using the
-     * initial color and coverage from this op's geometry processor.
-     */
-    GrProcessorSet::Analysis analyzeUpdateAndRecordProcessors(GrPipelineBuilder* pipelineBuilder,
-                                                              const GrAppliedClip* appliedClip,
-                                                              bool isMixedSamples,
-                                                              const GrCaps& caps,
-                                                              GrColor* overrideColor) const {
-        GrProcessorAnalysisColor inputColor;
-        GrProcessorAnalysisCoverage inputCoverage;
-        this->getProcessorAnalysisInputs(&inputColor, &inputCoverage);
-        return pipelineBuilder->finalizeProcessors(inputColor, inputCoverage, appliedClip,
-                                                   isMixedSamples, caps, overrideColor);
-    }
-
-    void initPipeline(const GrPipeline::InitArgs& args, const GrProcessorSet::Analysis& analysis,
-                      GrColor overrideColor) {
-        fPipeline.init(args);
-        this->applyPipelineOptimizations(PipelineOptimizations(analysis, overrideColor));
-    }
-
-    void addDependenciesTo(GrOpList* opList, const GrCaps& caps) {
-        fPipeline.addDependenciesTo(opList, caps);
-    }
-
-    /**
-     * Mesh draw ops use a legacy system in GrRenderTargetContext where the pipeline is created when
-     * the op is recorded. These methods are unnecessary as this information is in the pipeline.
-     */
-    FixedFunctionFlags fixedFunctionFlags() const override {
-        SkFAIL("This should never be called for legacy mesh draw ops.");
-        return FixedFunctionFlags::kNone;
-    }
-    RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override {
-        SkFAIL("Should never be called for legacy mesh draw ops.");
-        return RequiresDstTexture::kNo;
-    }
-
-protected:
-    GrLegacyMeshDrawOp(uint32_t classID) : INHERITED(classID) {}
-    /**
-     * This is a legacy class only used by GrLegacyMeshDrawOp and will be removed. It presents some
-     * aspects of GrProcessorSet::Analysis to GrLegacyMeshDrawOp subclasses.
-     */
-    class PipelineOptimizations {
-    public:
-        PipelineOptimizations(const GrProcessorSet::Analysis& analysis, GrColor overrideColor) {
-            fFlags = 0;
-            if (analysis.inputColorIsOverridden()) {
-                fFlags |= kUseOverrideColor_Flag;
-                fOverrideColor = overrideColor;
-            }
-            if (analysis.usesLocalCoords()) {
-                fFlags |= kReadsLocalCoords_Flag;
-            }
-            if (analysis.isCompatibleWithCoverageAsAlpha()) {
-                fFlags |= kCanTweakAlphaForCoverage_Flag;
-            }
-        }
-
-        /** Does the pipeline require access to (implicit or explicit) local coordinates? */
-        bool readsLocalCoords() const { return SkToBool(kReadsLocalCoords_Flag & fFlags); }
-
-        /** Does the pipeline allow the GrPrimitiveProcessor to combine color and coverage into one
-            color output ? */
-        bool canTweakAlphaForCoverage() const {
-            return SkToBool(kCanTweakAlphaForCoverage_Flag & fFlags);
-        }
-
-        /** Does the pipeline require the GrPrimitiveProcessor to specify a specific color (and if
-            so get the color)? */
-        bool getOverrideColorIfSet(GrColor* overrideColor) const {
-            if (SkToBool(kUseOverrideColor_Flag & fFlags)) {
-                if (overrideColor) {
-                    *overrideColor = fOverrideColor;
-                }
-                return true;
-            }
-            return false;
-        }
-
-    private:
-        enum {
-            // If this is not set the primitive processor need not produce local coordinates
-            kReadsLocalCoords_Flag = 0x1,
-            // If this flag is set then the primitive processor may produce color*coverage as
-            // its color output (and not output a separate coverage).
-            kCanTweakAlphaForCoverage_Flag = 0x2,
-            // If this flag is set the GrPrimitiveProcessor must produce fOverrideColor as its
-            // output color. If not set fOverrideColor is to be ignored.
-            kUseOverrideColor_Flag = 0x4,
-        };
-
-        uint32_t fFlags;
-        GrColor fOverrideColor;
-    };
-
-    const GrPipeline* pipeline() const {
-        SkASSERT(fPipeline.isInitialized());
-        return &fPipeline;
-    }
-
-private:
-    /**
-     * Provides information about the GrPrimitiveProccesor color and coverage outputs which become
-     * inputs to the first color and coverage fragment processors.
-     */
-    virtual void getProcessorAnalysisInputs(GrProcessorAnalysisColor*,
-                                            GrProcessorAnalysisCoverage*) const = 0;
-
-    /**
-     * After processor analysis is complete this is called so that the op can use the analysis
-     * results when constructing its GrPrimitiveProcessor.
-     */
-    virtual void applyPipelineOptimizations(const PipelineOptimizations&) = 0;
-
-    GrPipeline fPipeline;
-
-    typedef GrMeshDrawOp INHERITED;
-};
-
 #endif
diff --git a/src/gpu/ops/GrOvalOpFactory.h b/src/gpu/ops/GrOvalOpFactory.h
index 4c85ee8..1bdf3ee 100644
--- a/src/gpu/ops/GrOvalOpFactory.h
+++ b/src/gpu/ops/GrOvalOpFactory.h
@@ -12,7 +12,6 @@
 #include "SkRefCnt.h"
 
 class GrDrawOp;
-class GrLegacyMeshDrawOp;
 class GrPaint;
 class GrShaderCaps;
 class GrStyle;
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index a43790e..ddb2848 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -13,7 +13,6 @@
 #include "GrDistanceFieldGenFromVector.h"
 #include "GrDrawOpTest.h"
 #include "GrOpFlushState.h"
-#include "GrPipelineBuilder.h"
 #include "GrResourceProvider.h"
 #include "GrSWMaskHelper.h"
 #include "GrSimpleMeshDrawOpHelper.h"
@@ -383,7 +382,7 @@
         this->flush(target, &flushInfo);
     }
 
-    bool addDFPathToAtlas(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo,
+    bool addDFPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo,
                           GrDrawOpAtlas* atlas, ShapeData* shapeData, const GrShape& shape,
                           uint32_t dimension, SkScalar scale) const {
         const SkRect& bounds = shape.bounds();
@@ -500,7 +499,7 @@
         return true;
     }
 
-    bool addBMPathToAtlas(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo,
+    bool addBMPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo,
                           GrDrawOpAtlas* atlas, ShapeData* shapeData, const GrShape& shape,
                           const SkMatrix& ctm) const {
         const SkRect& bounds = shape.bounds();
@@ -672,7 +671,7 @@
         textureCoords[1] = t;
     }
 
-    void flush(GrLegacyMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
+    void flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
         if (flushInfo->fInstancesToFlush) {
             GrMesh mesh(GrPrimitiveType::kTriangles);
             int maxInstancesPerDraw =
diff --git a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
index a613841..4d86efd 100644
--- a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
@@ -12,7 +12,6 @@
 #include "GrFixedClip.h"
 #include "GrGpu.h"
 #include "GrPath.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContextPriv.h"
 #include "GrResourceProvider.h"
 #include "GrStencilPathOp.h"
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index ff16cae..d65e57e 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -14,7 +14,6 @@
 #include "GrMesh.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
-#include "GrPipelineBuilder.h"
 #include "GrResourceCache.h"
 #include "GrResourceProvider.h"
 #include "GrTessellator.h"
@@ -104,7 +103,7 @@
 
 class DynamicVertexAllocator : public GrTessellator::VertexAllocator {
 public:
-    DynamicVertexAllocator(size_t stride, GrLegacyMeshDrawOp::Target* target)
+    DynamicVertexAllocator(size_t stride, GrMeshDrawOp::Target* target)
             : VertexAllocator(stride)
             , fTarget(target)
             , fVertexBuffer(nullptr)
@@ -121,7 +120,7 @@
     const GrBuffer* vertexBuffer() const { return fVertexBuffer; }
     int firstVertex() const { return fFirstVertex; }
 private:
-    GrLegacyMeshDrawOp::Target* fTarget;
+    GrMeshDrawOp::Target* fTarget;
     const GrBuffer* fVertexBuffer;
     int fVertexCount;
     int fFirstVertex;
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 835105b..823444c 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -8,7 +8,6 @@
 #include "GrAtlasTextBlob.h"
 #include "GrBlurUtils.h"
 #include "GrContext.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrTextUtils.h"
 #include "SkColorFilter.h"
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 1bce341..5d03d58 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -24,7 +24,6 @@
 class GrBlobRegenHelper;
 struct GrDistanceFieldAdjustTable;
 class GrMemoryPool;
-class GrLegacyMeshDrawOp;
 class SkDrawFilter;
 class SkTextBlob;
 class SkTextBlobRunIterator;
diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h
index c47ec65..458a365 100644
--- a/src/gpu/text/GrAtlasTextContext.h
+++ b/src/gpu/text/GrAtlasTextContext.h
@@ -20,7 +20,6 @@
 
 class GrDrawOp;
 class GrRenderTargetContext;
-class GrPipelineBuilder;
 class GrTextBlobCache;
 class SkGlyph;
 
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index f53e5fe..7d04a14 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -10,7 +10,6 @@
 #include "GrContext.h"
 #include "GrPath.h"
 #include "GrPathRange.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrResourceProvider.h"
 #include "GrTextUtils.h"
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index aaab98a..ff87a33 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -13,7 +13,6 @@
 #if SK_SUPPORT_GPU
 
 #include "GrAppliedClip.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrRenderTargetPriv.h"
 #include "GrTypesPriv.h"
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 56ec0a6..fd025a0 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -13,7 +13,6 @@
 #include "GrClip.h"
 #include "GrContext.h"
 #include "GrGpuResource.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrRenderTargetContextPriv.h"
 #include "GrResourceProvider.h"
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 2014768..e867241 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -14,7 +14,6 @@
 #include "GrDrawingManager.h"
 #include "GrGpu.h"
 #include "GrGpuResourceCacheAccess.h"
-#include "GrPipelineBuilder.h"
 #include "GrRenderTargetContext.h"
 #include "GrRenderTargetContextPriv.h"
 #include "GrRenderTargetProxy.h"
@@ -246,30 +245,6 @@
 #define ASSERT_SINGLE_OWNER \
     SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->singleOwner());)
 
-uint32_t GrRenderTargetContextPriv::testingOnly_addLegacyMeshDrawOp(
-        GrPaint&& paint,
-        GrAAType aaType,
-        std::unique_ptr<GrLegacyMeshDrawOp> op,
-        const GrUserStencilSettings* uss,
-        bool snapToCenters) {
-    ASSERT_SINGLE_OWNER
-    if (fRenderTargetContext->drawingManager()->wasAbandoned()) {
-        return SK_InvalidUniqueID;
-    }
-    SkDEBUGCODE(fRenderTargetContext->validate());
-    GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
-                              "GrRenderTargetContext::testingOnly_addLegacyMeshDrawOp");
-
-    GrPipelineBuilder pipelineBuilder(std::move(paint), aaType);
-    if (uss) {
-        pipelineBuilder.setUserStencil(uss);
-    }
-    pipelineBuilder.setSnapVerticesToPixelCenters(snapToCenters);
-
-    return fRenderTargetContext->addLegacyMeshDrawOp(std::move(pipelineBuilder), GrNoClip(),
-                                                     std::move(op));
-}
-
 uint32_t GrRenderTargetContextPriv::testingOnly_addDrawOp(std::unique_ptr<GrDrawOp> op) {
     ASSERT_SINGLE_OWNER
     if (fRenderTargetContext->drawingManager()->wasAbandoned()) {