This renames methods and classes that relate to static analysis of combinations of GrDrawOps and GrPipelines.

Change-Id: I737b901a19d3c67d2ff7f95802fb4df35656beb2
Reviewed-on: https://skia-review.googlesource.com/6199
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index a824c89..73adc49 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -34,7 +34,7 @@
 private:
     CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage);
 
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis& analysis,
                                                  bool doesStencilWrite,
                                                  GrColor* color,
                                                  const GrCaps& caps) const override;
@@ -107,11 +107,10 @@
     return new GLCoverageSetOpXP(*this);
 }
 
-GrXferProcessor::OptFlags
-CoverageSetOpXP::onGetOptimizations(const GrPipelineOptimizations& optimizations,
-                                    bool doesStencilWrite,
-                                    GrColor* color,
-                                    const GrCaps& caps) const {
+GrXferProcessor::OptFlags CoverageSetOpXP::onGetOptimizations(const GrPipelineAnalysis& analysis,
+                                                              bool doesStencilWrite,
+                                                              GrColor* color,
+                                                              const GrCaps& caps) const {
     // We never look at the color input
     return GrXferProcessor::kIgnoreColor_OptFlag;
 }
@@ -168,7 +167,7 @@
     bool invertCoverage() const { return fInvertCoverage; }
 
 private:
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations&, bool, GrColor*,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis&, bool, GrColor*,
                                                  const GrCaps&) const override {
         // We never look at the color input
         return GrXferProcessor::kIgnoreColor_OptFlag;
@@ -310,11 +309,10 @@
     }
 }
 
-GrXferProcessor*
-GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
-                                                const GrPipelineOptimizations& optimizations,
-                                                bool hasMixedSamples,
-                                                const DstTexture* dst) const {
+GrXferProcessor* GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
+                                                                 const GrPipelineAnalysis& analysis,
+                                                                 bool hasMixedSamples,
+                                                                 const DstTexture* dst) const {
     // We don't support inverting coverage with mixed samples. We don't expect to ever want this in
     // the future, however we could at some point make this work using an inverted coverage
     // modulation table. Note that an inverted table still won't work if there are coverage procs.
@@ -323,7 +321,7 @@
         return nullptr;
     }
 
-    if (optimizations.fOverrides.fUsePLSDstRead) {
+    if (analysis.fUsesPLSDstRead) {
         return new ShaderCSOXferProcessor(dst, hasMixedSamples, fRegionOp, fInvertCoverage);
     }
     return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index f5962c2..2ae8f9c 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -53,15 +53,15 @@
 }
 
 static bool can_use_hw_blend_equation(GrBlendEquation equation,
-                                      const GrPipelineOptimizations& opt,
+                                      const GrPipelineAnalysis& analysis,
                                       const GrCaps& caps) {
     if (!caps.advancedBlendEquationSupport()) {
         return false;
     }
-    if (opt.fOverrides.fUsePLSDstRead) {
+    if (analysis.fUsesPLSDstRead) {
         return false;
     }
-    if (opt.fCoveragePOI.isFourChannelOutput()) {
+    if (analysis.fCoveragePOI.isFourChannelOutput()) {
         return false; // LCD coverage must be applied after the blend equation.
     }
     if (caps.canUseAdvancedBlendEquation(equation)) {
@@ -102,7 +102,7 @@
     }
 
 private:
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis&,
                                                  bool doesStencilWrite,
                                                  GrColor* overrideColor,
                                                  const GrCaps& caps) const override;
@@ -200,111 +200,113 @@
     return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation;
 }
 
-GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrPipelineOptimizations& optimizations,
+GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrPipelineAnalysis& analysis,
                                                        bool doesStencilWrite,
                                                        GrColor* overrideColor,
                                                        const GrCaps& caps) const {
-  /*
-    Most the optimizations we do here are based on tweaking alpha for coverage.
+    /*
+      Most the optimizations we do here are based on tweaking alpha for coverage.
 
-    The general SVG blend equation is defined in the spec as follows:
+      The general SVG blend equation is defined in the spec as follows:
 
-      Dca' = B(Sc, Dc) * Sa * Da + Y * Sca * (1-Da) + Z * Dca * (1-Sa)
-      Da'  = X * Sa * Da + Y * Sa * (1-Da) + Z * Da * (1-Sa)
+        Dca' = B(Sc, Dc) * Sa * Da + Y * Sca * (1-Da) + Z * Dca * (1-Sa)
+        Da'  = X * Sa * Da + Y * Sa * (1-Da) + Z * Da * (1-Sa)
 
-    (Note that Sca, Dca indicate RGB vectors that are premultiplied by alpha,
-     and that B(Sc, Dc) is a mode-specific function that accepts non-multiplied
-     RGB colors.)
+      (Note that Sca, Dca indicate RGB vectors that are premultiplied by alpha,
+       and that B(Sc, Dc) is a mode-specific function that accepts non-multiplied
+       RGB colors.)
 
-    For every blend mode supported by this class, i.e. the "advanced" blend
-    modes, X=Y=Z=1 and this equation reduces to the PDF blend equation.
+      For every blend mode supported by this class, i.e. the "advanced" blend
+      modes, X=Y=Z=1 and this equation reduces to the PDF blend equation.
 
-    It can be shown that when X=Y=Z=1, these equations can modulate alpha for
-    coverage.
+      It can be shown that when X=Y=Z=1, these equations can modulate alpha for
+      coverage.
 
 
-    == Color ==
+      == Color ==
 
-    We substitute Y=Z=1 and define a blend() function that calculates Dca' in
-    terms of premultiplied alpha only:
+      We substitute Y=Z=1 and define a blend() function that calculates Dca' in
+      terms of premultiplied alpha only:
 
-      blend(Sca, Dca, Sa, Da) = {Dca : if Sa == 0,
-                                 Sca : if Da == 0,
-                                 B(Sca/Sa, Dca/Da) * Sa * Da + Sca * (1-Da) + Dca * (1-Sa) : if Sa,Da != 0}
+        blend(Sca, Dca, Sa, Da) = {Dca : if Sa == 0,
+                                   Sca : if Da == 0,
+                                   B(Sca/Sa, Dca/Da) * Sa * Da + Sca * (1-Da) + Dca * (1-Sa) : if
+      Sa,Da != 0}
 
-    And for coverage modulation, we use a post blend src-over model:
+      And for coverage modulation, we use a post blend src-over model:
 
-      Dca'' = f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
+        Dca'' = f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
 
-    (Where f is the fractional coverage.)
+      (Where f is the fractional coverage.)
 
-    Next we show that canTweakAlphaForCoverage() is true by proving the
-    following relationship:
+      Next we show that canTweakAlphaForCoverage() is true by proving the
+      following relationship:
 
-      blend(f*Sca, Dca, f*Sa, Da) == f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
+        blend(f*Sca, Dca, f*Sa, Da) == f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
 
-    General case (f,Sa,Da != 0):
+      General case (f,Sa,Da != 0):
 
-      f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
-        = f * (B(Sca/Sa, Dca/Da) * Sa * Da + Sca * (1-Da) + Dca * (1-Sa)) + (1-f) * Dca  [Sa,Da != 0, definition of blend()]
-        = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) + f*Dca * (1-Sa) + Dca - f*Dca
-        = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca - f*Sca * Da + f*Dca - f*Dca * Sa + Dca - f*Dca
-        = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca - f*Sca * Da - f*Dca * Sa + Dca
-        = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) - f*Dca * Sa + Dca
-        = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) + Dca * (1 - f*Sa)
-        = B(f*Sca/f*Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) + Dca * (1 - f*Sa)  [f!=0]
-        = blend(f*Sca, Dca, f*Sa, Da)  [definition of blend()]
+        f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
+          = f * (B(Sca/Sa, Dca/Da) * Sa * Da + Sca * (1-Da) + Dca * (1-Sa)) + (1-f) * Dca  [Sa,Da !=
+      0, definition of blend()]
+          = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) + f*Dca * (1-Sa) + Dca - f*Dca
+          = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca - f*Sca * Da + f*Dca - f*Dca * Sa + Dca - f*Dca
+          = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca - f*Sca * Da - f*Dca * Sa + Dca
+          = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) - f*Dca * Sa + Dca
+          = B(Sca/Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) + Dca * (1 - f*Sa)
+          = B(f*Sca/f*Sa, Dca/Da) * f*Sa * Da + f*Sca * (1-Da) + Dca * (1 - f*Sa)  [f!=0]
+          = blend(f*Sca, Dca, f*Sa, Da)  [definition of blend()]
 
-    Corner cases (Sa=0, Da=0, and f=0):
+      Corner cases (Sa=0, Da=0, and f=0):
 
-      Sa=0: f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
-              = f * Dca + (1-f) * Dca  [Sa=0, definition of blend()]
-              = Dca
-              = blend(0, Dca, 0, Da)  [definition of blend()]
-              = blend(f*Sca, Dca, f*Sa, Da)  [Sa=0]
+        Sa=0: f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
+                = f * Dca + (1-f) * Dca  [Sa=0, definition of blend()]
+                = Dca
+                = blend(0, Dca, 0, Da)  [definition of blend()]
+                = blend(f*Sca, Dca, f*Sa, Da)  [Sa=0]
 
-      Da=0: f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
-              = f * Sca + (1-f) * Dca  [Da=0, definition of blend()]
-              = f * Sca  [Da=0]
-              = blend(f*Sca, 0, f*Sa, 0)  [definition of blend()]
-              = blend(f*Sca, Dca, f*Sa, Da)  [Da=0]
+        Da=0: f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
+                = f * Sca + (1-f) * Dca  [Da=0, definition of blend()]
+                = f * Sca  [Da=0]
+                = blend(f*Sca, 0, f*Sa, 0)  [definition of blend()]
+                = blend(f*Sca, Dca, f*Sa, Da)  [Da=0]
 
-      f=0: f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
-             = Dca  [f=0]
-             = blend(0, Dca, 0, Da)  [definition of blend()]
-             = blend(f*Sca, Dca, f*Sa, Da)  [f=0]
+        f=0: f * blend(Sca, Dca, Sa, Da) + (1-f) * Dca
+               = Dca  [f=0]
+               = blend(0, Dca, 0, Da)  [definition of blend()]
+               = blend(f*Sca, Dca, f*Sa, Da)  [f=0]
 
-    == Alpha ==
+      == Alpha ==
 
-    We substitute X=Y=Z=1 and define a blend() function that calculates Da':
+      We substitute X=Y=Z=1 and define a blend() function that calculates Da':
 
-      blend(Sa, Da) = Sa * Da + Sa * (1-Da) + Da * (1-Sa)
-                    = Sa * Da + Sa - Sa * Da + Da - Da * Sa
-                    = Sa + Da - Sa * Da
+        blend(Sa, Da) = Sa * Da + Sa * (1-Da) + Da * (1-Sa)
+                      = Sa * Da + Sa - Sa * Da + Da - Da * Sa
+                      = Sa + Da - Sa * Da
 
-    We use the same model for coverage modulation as we did with color:
+      We use the same model for coverage modulation as we did with color:
 
-      Da'' = f * blend(Sa, Da) + (1-f) * Da
+        Da'' = f * blend(Sa, Da) + (1-f) * Da
 
-    And show that canTweakAlphaForCoverage() is true by proving the following
-    relationship:
+      And show that canTweakAlphaForCoverage() is true by proving the following
+      relationship:
 
-      blend(f*Sa, Da) == f * blend(Sa, Da) + (1-f) * Da
+        blend(f*Sa, Da) == f * blend(Sa, Da) + (1-f) * Da
 
 
-      f * blend(Sa, Da) + (1-f) * Da
-        = f * (Sa + Da - Sa * Da) + (1-f) * Da
-        = f*Sa + f*Da - f*Sa * Da + Da - f*Da
-        = f*Sa - f*Sa * Da + Da
-        = f*Sa + Da - f*Sa * Da
-        = blend(f*Sa, Da)
-   */
+        f * blend(Sa, Da) + (1-f) * Da
+          = f * (Sa + Da - Sa * Da) + (1-f) * Da
+          = f*Sa + f*Da - f*Sa * Da + Da - f*Da
+          = f*Sa - f*Sa * Da + Da
+          = f*Sa + Da - f*Sa * Da
+          = blend(f*Sa, Da)
+     */
 
     OptFlags flags = kNone_OptFlags;
-    if (optimizations.fColorPOI.allStagesMultiplyInput()) {
+    if (analysis.fColorPOI.allStagesMultiplyInput()) {
         flags |= kCanTweakAlphaForCoverage_OptFlag;
     }
-    if (this->hasHWBlendEquation() && optimizations.fCoveragePOI.isSolidWhite()) {
+    if (this->hasHWBlendEquation() && analysis.fCoveragePOI.isSolidWhite()) {
         flags |= kIgnoreCoverage_OptFlag;
     }
     return flags;
@@ -333,11 +335,11 @@
 
 private:
     GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
-                                           const GrPipelineOptimizations& optimizations,
+                                           const GrPipelineAnalysis&,
                                            bool hasMixedSamples,
                                            const DstTexture*) const override;
 
-    bool onWillReadDstColor(const GrCaps&, const GrPipelineOptimizations&) const override;
+    bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const override;
 
     bool onIsEqual(const GrXPFactory& xpfBase) const override {
         const CustomXPFactory& xpf = xpfBase.cast<CustomXPFactory>();
@@ -360,10 +362,10 @@
 }
 
 GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
-                                                        const GrPipelineOptimizations& opt,
+                                                        const GrPipelineAnalysis& analysis,
                                                         bool hasMixedSamples,
                                                         const DstTexture* dstTexture) const {
-    if (can_use_hw_blend_equation(fHWBlendEquation, opt, caps)) {
+    if (can_use_hw_blend_equation(fHWBlendEquation, analysis, caps)) {
         SkASSERT(!dstTexture || !dstTexture->texture());
         return new CustomXP(fMode, fHWBlendEquation);
     }
@@ -371,8 +373,8 @@
 }
 
 bool CustomXPFactory::onWillReadDstColor(const GrCaps& caps,
-                                         const GrPipelineOptimizations& optimizations) const {
-    return !can_use_hw_blend_equation(fHWBlendEquation, optimizations, caps);
+                                         const GrPipelineAnalysis& analysis) const {
+    return !can_use_hw_blend_equation(fHWBlendEquation, analysis, caps);
 }
 
 void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp
index fc3d4bb..cfc7e03 100644
--- a/src/gpu/effects/GrDisableColorXP.cpp
+++ b/src/gpu/effects/GrDisableColorXP.cpp
@@ -29,7 +29,7 @@
 private:
     DisableColorXP();
 
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis&,
                                                  bool doesStencilWrite,
                                                  GrColor* color,
                                                  const GrCaps& caps) const override {
@@ -93,12 +93,11 @@
     this->initClassID<GrDisableColorXPFactory>();
 }
 
-GrXferProcessor*
-GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps,
-                                               const GrPipelineOptimizations& optimizations,
-                                               bool hasMixedSamples,
-                                               const DstTexture* dst) const {
-    SkASSERT(!optimizations.fOverrides.fUsePLSDstRead);
+GrXferProcessor* GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps,
+                                                                const GrPipelineAnalysis& analysis,
+                                                                bool hasMixedSamples,
+                                                                const DstTexture* dst) const {
+    SkASSERT(!analysis.fUsesPLSDstRead);
     return DisableColorXP::Create();
 }
 
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index 4aed6b6..cc02f41 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -28,11 +28,11 @@
     GrDisableColorXPFactory();
 
     GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
-                                           const GrPipelineOptimizations& optimizations,
+                                           const GrPipelineAnalysis&,
                                            bool hasMixedSamples,
                                            const DstTexture* dstTexture) const override;
 
-    bool onWillReadDstColor(const GrCaps&, const GrPipelineOptimizations&) const override {
+    bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const override {
         return false;
     }
 
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 3987db2..a6b5bbb 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -354,10 +354,10 @@
     BlendFormula getBlendFormula() const { return fBlendFormula; }
 
 private:
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis&,
                                                  bool doesStencilWrite,
                                                  GrColor* overrideColor,
-                                                 const GrCaps& caps) const override;
+                                                 const GrCaps&) const override;
 
     void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
 
@@ -471,11 +471,11 @@
     return new GLPorterDuffXferProcessor;
 }
 
-GrXferProcessor::OptFlags
-PorterDuffXferProcessor::onGetOptimizations(const GrPipelineOptimizations& optimizations,
-                                            bool doesStencilWrite,
-                                            GrColor* overrideColor,
-                                            const GrCaps& caps) const {
+GrXferProcessor::OptFlags PorterDuffXferProcessor::onGetOptimizations(
+        const GrPipelineAnalysis& analysis,
+        bool doesStencilWrite,
+        GrColor* overrideColor,
+        const GrCaps& caps) const {
     GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
     if (!fBlendFormula.modifiesDst()) {
         if (!doesStencilWrite) {
@@ -488,12 +488,12 @@
         if (!fBlendFormula.usesInputColor()) {
             optFlags |= GrXferProcessor::kIgnoreColor_OptFlag;
         }
-        if (optimizations.fCoveragePOI.isSolidWhite()) {
+        if (analysis.fCoveragePOI.isSolidWhite()) {
             optFlags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
         }
-        if (optimizations.fColorPOI.allStagesMultiplyInput() &&
+        if (analysis.fColorPOI.allStagesMultiplyInput() &&
             fBlendFormula.canTweakAlphaForCoverage() &&
-            !optimizations.fCoveragePOI.isFourChannelOutput()) {
+            !analysis.fCoveragePOI.isFourChannelOutput()) {
             optFlags |= GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag;
         }
     }
@@ -519,7 +519,7 @@
     SkBlendMode getXfermode() const { return fXfermode; }
 
 private:
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations&, bool, GrColor*,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis&, bool, GrColor*,
                                                  const GrCaps&) const override {
         return kNone_OptFlags;
     }
@@ -594,10 +594,10 @@
 private:
     PDLCDXferProcessor(GrColor blendConstant, uint8_t alpha);
 
-    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
+    GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineAnalysis&,
                                                  bool doesStencilWrite,
                                                  GrColor* overrideColor,
-                                                 const GrCaps& caps) const override;
+                                                 const GrCaps&) const override;
 
     void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
 
@@ -683,17 +683,16 @@
     return new GLPDLCDXferProcessor(*this);
 }
 
-GrXferProcessor::OptFlags
-PDLCDXferProcessor::onGetOptimizations(const GrPipelineOptimizations& optimizations,
-                                       bool doesStencilWrite,
-                                       GrColor* overrideColor,
-                                       const GrCaps& caps) const {
-        // We want to force our primary output to be alpha * Coverage, where alpha is the alpha
-        // value of the blend the constant. We should already have valid blend coeff's if we are at
-        // a point where we have RGB coverage. We don't need any color stages since the known color
-        // output is already baked into the blendConstant.
-        *overrideColor = GrColorPackRGBA(fAlpha, fAlpha, fAlpha, fAlpha);
-        return GrXferProcessor::kOverrideColor_OptFlag;
+GrXferProcessor::OptFlags PDLCDXferProcessor::onGetOptimizations(const GrPipelineAnalysis&,
+                                                                 bool doesStencilWrite,
+                                                                 GrColor* overrideColor,
+                                                                 const GrCaps& caps) const {
+    // We want to force our primary output to be alpha * Coverage, where alpha is the alpha
+    // value of the blend the constant. We should already have valid blend coeff's if we are at
+    // a point where we have RGB coverage. We don't need any color stages since the known color
+    // output is already baked into the blendConstant.
+    *overrideColor = GrColorPackRGBA(fAlpha, fAlpha, fAlpha, fAlpha);
+    return GrXferProcessor::kOverrideColor_OptFlag;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -734,29 +733,28 @@
     return sk_sp<GrXPFactory>(SkRef(gFactories[(int)xfermode]));
 }
 
-GrXferProcessor*
-GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
-                                             const GrPipelineOptimizations& optimizations,
-                                             bool hasMixedSamples,
-                                             const DstTexture* dstTexture) const {
-    if (optimizations.fOverrides.fUsePLSDstRead) {
+GrXferProcessor* GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
+                                                              const GrPipelineAnalysis& analysis,
+                                                              bool hasMixedSamples,
+                                                              const DstTexture* dstTexture) const {
+    if (analysis.fUsesPLSDstRead) {
         return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode);
     }
     BlendFormula blendFormula;
-    if (optimizations.fCoveragePOI.isFourChannelOutput()) {
+    if (analysis.fCoveragePOI.isFourChannelOutput()) {
         if (SkBlendMode::kSrcOver == fXfermode &&
-            kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
+            kRGBA_GrColorComponentFlags == analysis.fColorPOI.validFlags() &&
             !caps.shaderCaps()->dualSourceBlendingSupport() &&
             !caps.shaderCaps()->dstReadInShaderSupport()) {
             // If we don't have dual source blending or in shader dst reads, we fall back to this
             // trick for rendering SrcOver LCD text instead of doing a dst copy.
             SkASSERT(!dstTexture || !dstTexture->texture());
-            return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI);
+            return PDLCDXferProcessor::Create(fXfermode, analysis.fColorPOI);
         }
-        blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, fXfermode);
+        blendFormula = get_lcd_blend_formula(analysis.fCoveragePOI, fXfermode);
     } else {
-        blendFormula = get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
-                                         hasMixedSamples, fXfermode);
+        blendFormula = get_blend_formula(analysis.fColorPOI, analysis.fCoveragePOI, hasMixedSamples,
+                                         fXfermode);
     }
 
     if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
@@ -799,7 +797,7 @@
 }
 
 bool GrPorterDuffXPFactory::onWillReadDstColor(const GrCaps& caps,
-                                               const GrPipelineOptimizations& optimizations) const {
+                                               const GrPipelineAnalysis& analysis) const {
     if (caps.shaderCaps()->dualSourceBlendingSupport()) {
         return false;
     }
@@ -807,21 +805,22 @@
     // When we have four channel coverage we always need to read the dst in order to correctly
     // blend. The one exception is when we are using srcover mode and we know the input color into
     // the XP.
-    if (optimizations.fCoveragePOI.isFourChannelOutput()) {
+    if (analysis.fCoveragePOI.isFourChannelOutput()) {
         if (SkBlendMode::kSrcOver == fXfermode &&
-            kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
+            kRGBA_GrColorComponentFlags == analysis.fColorPOI.validFlags() &&
             !caps.shaderCaps()->dstReadInShaderSupport()) {
             return false;
         }
-        return get_lcd_blend_formula(optimizations.fCoveragePOI, fXfermode).hasSecondaryOutput();
+        return get_lcd_blend_formula(analysis.fCoveragePOI, fXfermode).hasSecondaryOutput();
     }
 
     // We fallback on the shader XP when the blend formula would use dual source blending but we
     // don't have support for it.
     static const bool kHasMixedSamples = false;
     SkASSERT(!caps.usesMixedSamples()); // We never use mixed samples without dual source blending.
-    return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI, kHasMixedSamples,
-                             fXfermode).hasSecondaryOutput();
+    auto formula = get_blend_formula(analysis.fColorPOI, analysis.fCoveragePOI, kHasMixedSamples,
+                                     fXfermode);
+    return formula.hasSecondaryOutput();
 }
 
 GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
@@ -856,10 +855,10 @@
 
 GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
         const GrCaps& caps,
-        const GrPipelineOptimizations& optimizations,
+        const GrPipelineAnalysis& analysis,
         bool hasMixedSamples,
         const GrXferProcessor::DstTexture* dstTexture) {
-    if (optimizations.fOverrides.fUsePLSDstRead) {
+    if (analysis.fUsesPLSDstRead) {
         return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkBlendMode::kSrcOver);
     }
 
@@ -867,7 +866,7 @@
     // doing lcd blending we will just use our global SimpleSrcOverXP. This slightly differs from
     // the general case where we convert a src-over blend that has solid coverage and an opaque
     // color to src-mode, which allows disabling of blending.
-    if (!optimizations.fCoveragePOI.isFourChannelOutput()) {
+    if (!analysis.fCoveragePOI.isFourChannelOutput()) {
         // We return nullptr here, which our caller interprets as meaning "use SimpleSrcOverXP".
         // We don't simply return the address of that XP here because our caller would have to unref
         // it and since it is a global object and GrProgramElement's ref-cnting system is not thread
@@ -875,18 +874,18 @@
         return nullptr;
     }
 
-    if (kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
+    if (kRGBA_GrColorComponentFlags == analysis.fColorPOI.validFlags() &&
         !caps.shaderCaps()->dualSourceBlendingSupport() &&
         !caps.shaderCaps()->dstReadInShaderSupport()) {
         // If we don't have dual source blending or in shader dst reads, we fall
         // back to this trick for rendering SrcOver LCD text instead of doing a
         // dst copy.
         SkASSERT(!dstTexture || !dstTexture->texture());
-        return PDLCDXferProcessor::Create(SkBlendMode::kSrcOver, optimizations.fColorPOI);
+        return PDLCDXferProcessor::Create(SkBlendMode::kSrcOver, analysis.fColorPOI);
     }
 
     BlendFormula blendFormula;
-    blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, SkBlendMode::kSrcOver);
+    blendFormula = get_lcd_blend_formula(analysis.fCoveragePOI, SkBlendMode::kSrcOver);
     if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
         return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkBlendMode::kSrcOver);
     }
@@ -896,7 +895,7 @@
 }
 
 bool GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(const GrCaps& caps,
-                                                     const GrPipelineOptimizations& optimizations) {
+                                                      const GrPipelineAnalysis& analysis) {
     if (caps.shaderCaps()->dstReadInShaderSupport() ||
         caps.shaderCaps()->dualSourceBlendingSupport()) {
         return false;
@@ -905,19 +904,20 @@
     // When we have four channel coverage we always need to read the dst in order to correctly
     // blend. The one exception is when we are using srcover mode and we know the input color
     // into the XP.
-    if (optimizations.fCoveragePOI.isFourChannelOutput()) {
-        if (kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
+    if (analysis.fCoveragePOI.isFourChannelOutput()) {
+        if (kRGBA_GrColorComponentFlags == analysis.fColorPOI.validFlags() &&
             !caps.shaderCaps()->dstReadInShaderSupport()) {
             return false;
         }
-        return get_lcd_blend_formula(optimizations.fCoveragePOI,
-                                     SkBlendMode::kSrcOver).hasSecondaryOutput();
+        auto formula = get_lcd_blend_formula(analysis.fCoveragePOI, SkBlendMode::kSrcOver);
+        return formula.hasSecondaryOutput();
     }
 
     // We fallback on the shader XP when the blend formula would use dual source blending but we
     // don't have support for it.
     static const bool kHasMixedSamples = false;
     SkASSERT(!caps.usesMixedSamples()); // We never use mixed samples without dual source blending.
-    return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
-                             kHasMixedSamples, SkBlendMode::kSrcOver).hasSecondaryOutput();
+    auto formula = get_blend_formula(analysis.fColorPOI, analysis.fCoveragePOI, kHasMixedSamples,
+                                     SkBlendMode::kSrcOver);
+    return formula.hasSecondaryOutput();
 }