Remove canApplyCoverage from XP and all related functions in gpu code.
authoregdaniel <egdaniel@google.com>
Mon, 23 Feb 2015 20:12:54 +0000 (12:12 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 23 Feb 2015 20:12:54 +0000 (12:12 -0800)
BUG=skia:

Review URL: https://codereview.chromium.org/919683002

include/gpu/GrXferProcessor.h
include/gpu/effects/GrCoverageSetOpXP.h
include/gpu/effects/GrPorterDuffXferProcessor.h
src/effects/SkArithmeticMode_gpu.h
src/gpu/GrContext.cpp
src/gpu/GrOvalRenderer.cpp
src/gpu/GrPipelineBuilder.cpp
src/gpu/GrPipelineBuilder.h
src/gpu/effects/GrCustomXfermodePriv.h
src/gpu/effects/GrDisableColorXP.h

index 8cb5cb17698f84464acc8ee14d27c337636b1a5f..87663b1a1f92093fd098ab8898d0730fa5319e2a 100644 (file)
@@ -232,18 +232,6 @@ public:
      */
     virtual bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const = 0;
 
-    /**
-     * Depending on color blend mode requested it may or may not be possible to correctly blend with
-     * fractional pixel coverage generated by the fragment shader.
-     *
-     * This function considers the known color and coverage input into the xfer processor and
-     * certain state information (colorWriteDisabled) to determine whether
-     * coverage can be handled correctly.
-     */
-    virtual bool canApplyCoverage(const GrProcOptInfo& colorPOI,
-                                  const GrProcOptInfo& coveragePOI) const = 0;
-
-
     struct InvariantOutput {
         bool        fWillBlendWithDst;
         GrColor     fBlendedColor;
index a95326f4840ab5f34e23a2be66b38a7afcfae0cf..9435b845d4635fd8647dc2e17fb560de82723734 100644 (file)
@@ -28,11 +28,6 @@ public:
         return true;
     }
 
-    bool canApplyCoverage(const GrProcOptInfo& /*colorPOI*/,
-                          const GrProcOptInfo& /*coveragePOI*/) const SK_OVERRIDE {
-        return true;
-    }
-
     bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; }
 
     void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
index 2bfcff28420f5af39e9789a8b3b80711f07a5a1d..3bcdf0edffe5b3072ae9654321a143725f626c4b 100644 (file)
@@ -20,11 +20,6 @@ public:
 
     bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE;
 
-    bool canApplyCoverage(const GrProcOptInfo& /*colorPOI*/,
-                          const GrProcOptInfo& /*coveragePOI*/) const SK_OVERRIDE {
-        return true;
-    }
-
     bool canTweakAlphaForCoverage() const SK_OVERRIDE;
 
     void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
index 546902dd50f97b99cd10b7ea165dbff06115944c..8fb58a1796844deb74a0b191b8edda5fa22fc8ca 100644 (file)
@@ -81,11 +81,6 @@ public:
         return true;
     }
 
-    bool canApplyCoverage(const GrProcOptInfo& colorPOI,
-                          const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
-        return true;
-    }
-
     bool canTweakAlphaForCoverage() const SK_OVERRIDE {
         return false;
     }
index 98e78d9926e08443dd1f06ed171374f9ae3ecb22..c444b66baa040c780ada56be60e98d7beb92212f 100755 (executable)
@@ -460,14 +460,6 @@ static bool apply_aa_to_rect(GrDrawTarget* target,
                              SkScalar strokeWidth,
                              const SkMatrix& combinedMatrix,
                              GrColor color) {
-    if (!pipelineBuilder->canTweakAlphaForCoverage() &&
-        !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
-#ifdef SK_DEBUG
-        //SkDebugf("Turning off AA to correctly apply blend.\n");
-#endif
-        return false;
-    }
-
     if (pipelineBuilder->getRenderTarget()->isMultisampled()) {
         return false;
     }
@@ -869,11 +861,6 @@ static bool is_nested_rects(GrDrawTarget* target,
         return false;
     }
 
-    if (!pipelineBuilder->canTweakAlphaForCoverage() &&
-        !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
-        return false;
-    }
-
     SkPath::Direction dirs[2];
     if (!path.isNestedRects(rects, dirs)) {
         return false;
@@ -1008,8 +995,7 @@ void GrContext::internalDrawPath(GrDrawTarget* target,
     // aa. If we have some future driver-mojo path AA that can do the right
     // thing WRT to the blend then we'll need some query on the PR.
     bool useCoverageAA = useAA &&
-        !pipelineBuilder->getRenderTarget()->isMultisampled() &&
-        pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
+        !pipelineBuilder->getRenderTarget()->isMultisampled();
 
 
     GrPathRendererChain::DrawType type =
index d7f88fe137c25c1fcbadaf220838e6ea144a9345..14f8fdec4a148fcbd8b3409d1e2960ce8f971f92 100644 (file)
@@ -658,8 +658,7 @@ bool GrOvalRenderer::drawOval(GrDrawTarget* target,
                               const SkStrokeRec& stroke)
 {
     bool useCoverageAA = useAA &&
-        !pipelineBuilder->getRenderTarget()->isMultisampled() &&
-        pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
+        !pipelineBuilder->getRenderTarget()->isMultisampled();
 
     if (!useCoverageAA) {
         return false;
@@ -1555,8 +1554,7 @@ bool GrOvalRenderer::drawDRRect(GrDrawTarget* target,
                                 const SkRRect& origOuter,
                                 const SkRRect& origInner) {
     bool applyAA = useAA &&
-                   !pipelineBuilder->getRenderTarget()->isMultisampled() &&
-                   pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
+                   !pipelineBuilder->getRenderTarget()->isMultisampled();
     GrPipelineBuilder::AutoRestoreEffects are;
     if (!origInner.isEmpty()) {
         SkTCopyOnFirstWrite<SkRRect> inner(origInner);
@@ -2044,8 +2042,7 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target,
     }
 
     bool useCoverageAA = useAA &&
-        !pipelineBuilder->getRenderTarget()->isMultisampled() &&
-        pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
+        !pipelineBuilder->getRenderTarget()->isMultisampled();
 
     // only anti-aliased rrects for now
     if (!useCoverageAA) {
index 6885eb0dd80b99c05915dd28d030249baabc001e..9117a1fea3ca31a981ba0c1e62df73d6d385bbb9 100644 (file)
@@ -82,23 +82,6 @@ void GrPipelineBuilder::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
     fCoverageCache = GrColor_ILLEGAL;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-
-bool GrPipelineBuilder::canUseFracCoveragePrimProc(GrColor color,
-                                                   const GrDrawTargetCaps& caps) const {
-    if (caps.dualSourceBlendingSupport()) {
-        return true;
-    }
-
-    this->calcColorInvariantOutput(color);
-
-    // The coverage isn't actually white, its unknown, but this will produce the same effect
-    // TODO we want to cache the result of this call, but we can probably clean up the interface
-    // so we don't have to pass in a seemingly known coverage
-    this->calcCoverageInvariantOutput(GrColor_WHITE);
-    return this->getXPFactory()->canApplyCoverage(fColorProcInfo, fCoverageProcInfo);
-}
-
 //////////////////////////////////////////////////////////////////////////////s
 
 bool GrPipelineBuilder::willXPNeedDstCopy(const GrDrawTargetCaps& caps,
index ad509e14f8a57cb1e3203661daeec2b80b5024c6..904d38250c6732a5aab8d73219ac4688edfd2adb 100644 (file)
@@ -48,18 +48,6 @@ public:
 
     /// @}
 
-    /**
-     * Depending on features available in the underlying 3D API and the color blend mode requested
-     * it may or may not be possible to correctly blend with fractional pixel coverage generated by
-     * the fragment shader.
-     *
-     * This function considers the current GrPipelineBuilder and the draw target's capabilities to
-     * determine whether coverage can be handled correctly. This function assumes that the caller
-     * intends to specify fractional pixel coverage via a primitive processor but may not have
-     * specified it yet.
-     */
-    bool canUseFracCoveragePrimProc(GrColor color, const GrDrawTargetCaps& caps) const;
-
     /**
      * This function returns true if the render target destination pixel values will be read for
      * blending during draw.
index 8672529e45e281a4d5c470fddb778cd41bb9d9cd..85092a989221a87719ecfd9e8da3cea68f347c41 100644 (file)
@@ -64,11 +64,6 @@ public:
         return true;
     }
 
-    bool canApplyCoverage(const GrProcOptInfo& colorPOI,
-                          const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
-        return true;
-    }
-
     bool canTweakAlphaForCoverage() const SK_OVERRIDE {
         return false;
     }
index 00675884a96bbf7e684356d049ab2a3af781e3cb..fb855ee520203d070b555f46922303c8e3c3b147 100644 (file)
@@ -23,11 +23,6 @@ public:
         return true;
     }
 
-    bool canApplyCoverage(const GrProcOptInfo& colorPOI,
-                          const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
-        return true;
-    }
-
     bool canTweakAlphaForCoverage() const SK_OVERRIDE { return true; }
 
     void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,