Remove GrPipelineOptimizations computation from GrPipeline::init and nest in GrMeshDrawOp.

Change-Id: I4a702c83857606c1cb050294c408922eef5769ea
Reviewed-on: https://skia-review.googlesource.com/10414
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index d8f7fbd..0a4a36c 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -18,7 +18,7 @@
 
 #include "ops/GrOp.h"
 
-GrPipelineOptimizations GrPipeline::init(const InitArgs& args) {
+void GrPipeline::init(const InitArgs& args) {
     SkASSERT(args.fAnalysis);
     SkASSERT(args.fRenderTarget);
 
@@ -106,21 +106,6 @@
             fFragmentProcessors[currFPIdx].reset(fp);
         }
     }
-
-    // Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline.
-    GrPipelineOptimizations optimizations;
-    optimizations.fFlags = 0;
-    if (GrColor_ILLEGAL != overrideColor) {
-        optimizations.fFlags |= GrPipelineOptimizations::kUseOverrideColor_Flag;
-        optimizations.fOverrideColor = overrideColor;
-    }
-    if (args.fAnalysis->usesLocalCoords()) {
-        optimizations.fFlags |= GrPipelineOptimizations::kReadsLocalCoords_Flag;
-    }
-    if (args.fAnalysis->isCompatibleWithCoverageAsAlpha()) {
-        optimizations.fFlags |= GrPipelineOptimizations::kCanTweakAlphaForCoverage_Flag;
-    }
-    return optimizations;
 }
 
 static void add_dependencies_for_processor(const GrFragmentProcessor* proc, GrRenderTarget* rt) {
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 2169342..7c861b2 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -12,7 +12,6 @@
 #include "GrFragmentProcessor.h"
 #include "GrNonAtomicRef.h"
 #include "GrPendingProgramElement.h"
-#include "GrPrimitiveProcessor.h"
 #include "GrProcessorSet.h"
 #include "GrProgramDesc.h"
 #include "GrScissorState.h"
@@ -79,7 +78,7 @@
     GrPipeline(GrRenderTarget*, SkBlendMode);
 
     /** (Re)initializes a pipeline. After initialization the pipeline can be used. */
-    GrPipelineOptimizations init(const InitArgs&);
+    void init(const InitArgs&);
 
     /** True if the pipeline has been initialized. */
     bool isInitialized() const { return SkToBool(fRenderTarget.get()); }
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index 4c43943..17e49c7 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -33,63 +33,6 @@
 
 class GrGLSLPrimitiveProcessor;
 
-struct GrInitInvariantOutput;
-
-/*
- * This class allows the GrPipeline to communicate information about the pipeline to a GrOp which
- * inform its decisions for GrPrimitiveProcessor setup. These are not properly part of the pipeline
- * because they reflect the specific inputs that the op provided to perform the analysis (e.g. that
- * the GrGeometryProcessor would output an opaque color).
- *
- * The pipeline analysis that produced this may have decided to elide some GrProcessors. However,
- * those elisions may depend upon changing the color output by the GrGeometryProcessor used by the
- * GrDrawOp. The op must check getOverrideColorIfSet() for this.
- */
-class GrPipelineOptimizations {
-public:
-    /** 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;
-
-    friend class GrPipeline; // To initialize this
-};
-
 /*
  * GrPrimitiveProcessor defines an interface which all subclasses must implement.  All
  * GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh color / coverage
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp
index d17c187..0e40a85 100644
--- a/src/gpu/GrProgramDesc.cpp
+++ b/src/gpu/GrProgramDesc.cpp
@@ -5,9 +5,9 @@
  * found in the LICENSE file.
  */
 #include "GrProgramDesc.h"
-
-#include "GrProcessor.h"
 #include "GrPipeline.h"
+#include "GrPrimitiveProcessor.h"
+#include "GrProcessor.h"
 #include "GrRenderTargetPriv.h"
 #include "GrShaderCaps.h"
 #include "GrTexturePriv.h"
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 79259b4..09d8267 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -753,7 +753,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
 
         fUsesLocalCoords = optimizations.readsLocalCoords();
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index c6aadb9..9919129 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -193,7 +193,7 @@
         return str;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         GrColor color;
         if (optimizations.getOverrideColorIfSet(&color)) {
             this->first()->setColor(color);
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 494138d..a243228 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -716,7 +716,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
         fUsesLocalCoords = optimizations.readsLocalCoords();
     }
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index c9add9d..a62a41c 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -178,7 +178,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fPaths[0].fColor);
         fUsesLocalCoords = optimizations.readsLocalCoords();
         fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index 89739e6..5866b0d 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -179,7 +179,7 @@
         color->setToConstant(fRects[0].fColor);
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
-    void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
+    void applyPipelineOptimizations(const PipelineOptimizations&) override;
     void onPrepareDraws(Target*) const override;
 
     static const int kMiterIndexCnt = 3 * 24;
@@ -230,7 +230,7 @@
     typedef GrMeshDrawOp INHERITED;
 };
 
-void AAStrokeRectOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
+void AAStrokeRectOp::applyPipelineOptimizations(const PipelineOptimizations& optimizations) {
     optimizations.getOverrideColorIfSet(&fRects[0].fColor);
 
     fUsesLocalCoords = optimizations.readsLocalCoords();
diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp
index 87922cc..6184144 100644
--- a/src/gpu/ops/GrAnalyticRectOp.cpp
+++ b/src/gpu/ops/GrAnalyticRectOp.cpp
@@ -275,7 +275,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index f8c5443..903382a 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -68,7 +68,7 @@
     }
 }
 
-void GrAtlasTextOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
+void GrAtlasTextOp::applyPipelineOptimizations(const PipelineOptimizations& optimizations) {
     optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
 
     fColor = fGeoData[0].fColor;
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 8c08544..9dc5631 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -101,7 +101,7 @@
 private:
     void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor*,
                                             GrPipelineAnalysisCoverage*) const override;
-    void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
+    void applyPipelineOptimizations(const PipelineOptimizations&) override;
 
     struct FlushInfo {
         sk_sp<const GrBuffer> fVertexBuffer;
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 9dfacde..e623007 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -302,7 +302,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
 
         fUsesLocalCoords = optimizations.readsLocalCoords();
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 62c9d45..79ad484 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -139,7 +139,7 @@
                                              : GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
         fUsesLocalCoords = optimizations.readsLocalCoords();
     }
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index 7ef7e06..36131e1 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -12,7 +12,7 @@
 #include "SkRSXform.h"
 #include "SkRandom.h"
 
-void GrDrawAtlasOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
+void GrDrawAtlasOp::applyPipelineOptimizations(const PipelineOptimizations& optimizations) {
     SkASSERT(fGeoData.count() == 1);
     if (optimizations.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) {
         size_t vertexStride =
diff --git a/src/gpu/ops/GrDrawAtlasOp.h b/src/gpu/ops/GrDrawAtlasOp.h
index a39a7a9..1094db0 100644
--- a/src/gpu/ops/GrDrawAtlasOp.h
+++ b/src/gpu/ops/GrDrawAtlasOp.h
@@ -51,7 +51,7 @@
 
     void onPrepareDraws(Target*) const override;
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
+    void applyPipelineOptimizations(const PipelineOptimizations&) override;
 
     GrColor color() const { return fColor; }
     const SkMatrix& viewMatrix() const { return fViewMatrix; }
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp
index 0a3df45..8a989b0 100644
--- a/src/gpu/ops/GrDrawPathOp.cpp
+++ b/src/gpu/ops/GrDrawPathOp.cpp
@@ -27,8 +27,7 @@
     return string;
 }
 
-GrPipelineOptimizations GrDrawPathOpBase::initPipeline(const GrOpFlushState& state,
-                                                       GrPipeline* pipeline) {
+void GrDrawPathOpBase::initPipeline(const GrOpFlushState& state, GrPipeline* pipeline) {
     static constexpr GrUserStencilSettings kCoverPass{
             GrUserStencilSettings::StaticInit<
                     0x0000,
@@ -65,11 +64,9 @@
 //////////////////////////////////////////////////////////////////////////////
 
 void GrDrawPathOp::onExecute(GrOpFlushState* state) {
-    GrColor color = this->color();
     GrPipeline pipeline;
-    GrPipelineOptimizations optimizations = this->initPipeline(*state, &pipeline);
-    optimizations.getOverrideColorIfSet(&color);
-    sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(color, this->viewMatrix()));
+    this->initPipeline(*state, &pipeline);
+    sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->viewMatrix()));
 
     GrStencilSettings stencil;
     init_stencil_pass_settings(*state, this->fillType(), &stencil);
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index 5650b88..78ed035 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -39,7 +39,7 @@
     GrColor color() const { return fAnalysis.inputColor(); }
     GrPathRendering::FillType fillType() const { return fFillType; }
     const GrProcessorSet& processors() const { return fProcessorSet; }
-    GrPipelineOptimizations initPipeline(const GrOpFlushState&, GrPipeline*);
+    void initPipeline(const GrOpFlushState&, GrPipeline*);
     const GrProcessorSet::FragmentProcessorAnalysis& doFragmentProcessorAnalysis(
             const GrCaps& caps, const GrAppliedClip* clip) {
         fProcessorSet.analyzeAndEliminateFragmentProcessors(
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index d8f91fe..6751009 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -84,7 +84,7 @@
     *coverage = GrPipelineAnalysisCoverage::kNone;
 }
 
-void GrDrawVerticesOp::applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) {
+void GrDrawVerticesOp::applyPipelineOptimizations(const PipelineOptimizations& optimizations) {
     SkASSERT(fMeshes.count() == 1);
     GrColor overrideColor;
     if (optimizations.getOverrideColorIfSet(&overrideColor)) {
diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h
index 176b552..17e54b7 100644
--- a/src/gpu/ops/GrDrawVerticesOp.h
+++ b/src/gpu/ops/GrDrawVerticesOp.h
@@ -72,7 +72,7 @@
 
     void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
                                             GrPipelineAnalysisCoverage* coverage) const override;
-    void applyPipelineOptimizations(const GrPipelineOptimizations&) override;
+    void applyPipelineOptimizations(const PipelineOptimizations&) override;
     void onPrepareDraws(Target*) const override;
 
     sk_sp<GrGeometryProcessor> makeGP(bool* hasColorAttribute, bool* hasLocalCoordAttribute) const;
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index 598a839..85ddd9d 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -67,7 +67,7 @@
         *coverage = GrPipelineAnalysisCoverage::kNone;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& analysioptimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& analysioptimizations) override {
         analysioptimizations.getOverrideColorIfSet(&fPatches[0].fColor);
     }
 
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index 4e7f036..9f20808 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -265,7 +265,7 @@
         *coverage = GrPipelineAnalysisCoverage::kNone;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fPaths[0].fColor);
     }
 
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index cbf1f62..2632feb 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -40,7 +40,8 @@
     }
 
     void initPipeline(const GrPipeline::InitArgs& args) {
-        this->applyPipelineOptimizations(fPipeline.init(args));
+        fPipeline.init(args);
+        this->applyPipelineOptimizations(PipelineOptimizations(*args.fAnalysis));
     }
 
     /**
@@ -58,6 +59,62 @@
 
 protected:
     GrMeshDrawOp(uint32_t classID);
+    /**
+     * This is a legacy class only used by GrMeshDrawOp and will be removed. It presents some
+     * aspects of GrProcessorSet::FragmentProcessorAnalysis to GrMeshDrawOp subclasses.
+     */
+    class PipelineOptimizations {
+    public:
+        PipelineOptimizations(const GrProcessorSet::FragmentProcessorAnalysis& analysis) {
+            fFlags = 0;
+            if (analysis.getInputColorOverrideAndColorProcessorEliminationCount(&fOverrideColor) >=
+                0) {
+                fFlags |= kUseOverrideColor_Flag;
+            }
+            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;
+    };
 
     /** Helper for rendering instances using an instanced index index buffer. This class creates the
         space for the vertices and flushes the draws to the GrMeshDrawOp::Target. */
@@ -111,7 +168,7 @@
      * After GrPipeline analysis is complete this is called so that the op can use the analysis
      * results when constructing its GrPrimitiveProcessor.
      */
-    virtual void applyPipelineOptimizations(const GrPipelineOptimizations&) = 0;
+    virtual void applyPipelineOptimizations(const PipelineOptimizations&) = 0;
 
     void onPrepare(GrOpFlushState* state) final;
     void onExecute(GrOpFlushState* state) final;
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index ce4b21f..66a8515 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -116,7 +116,7 @@
         *coverage = GrPipelineAnalysisCoverage::kNone;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fRects[0].fColor);
     }
 
diff --git a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
index 324ea43..9ccc743 100644
--- a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
@@ -136,7 +136,7 @@
         *coverage = GrPipelineAnalysisCoverage::kNone;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fRects[0].fColor);
     }
 
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index 2f63d96..940afee 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -161,7 +161,7 @@
         target->draw(gp.get(), mesh);
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
         fNeedsLocalCoords = optimizations.readsLocalCoords();
     }
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 83e783f..de4e4ea 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -811,7 +811,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
@@ -1263,7 +1263,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
         }
@@ -1478,7 +1478,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
         fUsesLocalCoords = optimizations.readsLocalCoords();
     }
@@ -1794,7 +1794,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
@@ -2158,7 +2158,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index 0ebec98..88f96bf 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -83,7 +83,7 @@
         *coverage = GrPipelineAnalysisCoverage::kNone;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fRegions[0].fColor);
     }
 
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index bc1a4cc..56855a1 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -148,7 +148,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fCircles[0].fColor);
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
@@ -569,7 +569,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fGeoData[0].fColor);
         if (!optimizations.readsLocalCoords()) {
             fViewMatrixIfUsingLocalCoords.reset();
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 8d3f7b7..408bcfe 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -205,7 +205,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fShapes[0].fColor);
         fUsesLocalCoords = optimizations.readsLocalCoords();
     }
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index 9149988..96fe8ab 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -186,7 +186,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
         fCanTweakAlphaForCoverage = optimizations.canTweakAlphaForCoverage();
         fNeedsLocalCoords = optimizations.readsLocalCoords();
diff --git a/src/gpu/ops/GrTestMeshDrawOp.h b/src/gpu/ops/GrTestMeshDrawOp.h
index a4bf066..8273aba 100644
--- a/src/gpu/ops/GrTestMeshDrawOp.h
+++ b/src/gpu/ops/GrTestMeshDrawOp.h
@@ -39,7 +39,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
         fUsesLocalCoords = optimizations.readsLocalCoords();
     }
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 46f9f6e..0170488 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1003,7 +1003,7 @@
             *coverage = GrPipelineAnalysisCoverage::kLCD;
         }
 
-        void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}
+        void applyPipelineOptimizations(const PipelineOptimizations&) override {}
         bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; }
         void onPrepareDraws(Target*) const override {}
 
diff --git a/tests/PreFlushCallbackTest.cpp b/tests/PreFlushCallbackTest.cpp
index e008009..7c4092c 100644
--- a/tests/PreFlushCallbackTest.cpp
+++ b/tests/PreFlushCallbackTest.cpp
@@ -70,7 +70,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
+    void applyPipelineOptimizations(const PipelineOptimizations& optimizations) override {
         optimizations.getOverrideColorIfSet(&fColor);
     }
 
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 0a9d002..2b4e349 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -46,7 +46,7 @@
         *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
     }
 
-    void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}
+    void applyPipelineOptimizations(const PipelineOptimizations&) override {}
     bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; }
     void onPrepareDraws(Target* target) const override {
         class GP : public GrGeometryProcessor {