Remove GrFragmentProcessor::computeInvariantOutput
authorBrian Salomon <bsalomon@google.com>
Sun, 12 Feb 2017 14:28:54 +0000 (09:28 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 13 Feb 2017 15:32:00 +0000 (15:32 +0000)
Change-Id: If475730103052c6097eb91be06808fb723b70bf8
Reviewed-on: https://skia-review.googlesource.com/8330
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>

75 files changed:
experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
gn/gpu.gni
gn/tests.gni
include/gpu/GrFragmentProcessor.h
include/gpu/GrInvariantOutput.h [deleted file]
include/gpu/effects/GrBlurredEdgeFragmentProcessor.h
include/gpu/effects/GrConstColorProcessor.h
src/core/SkColorMatrixFilterRowMajor255.cpp
src/core/SkLightingShader.cpp
src/core/SkModeColorFilter.cpp
src/core/SkNormalBevelSource.cpp
src/core/SkNormalFlatSource.cpp
src/core/SkNormalMapSource.cpp
src/core/SkRadialShadowMapShader.cpp
src/core/SkShadowShader.cpp
src/effects/GrAlphaThresholdFragmentProcessor.cpp
src/effects/GrAlphaThresholdFragmentProcessor.h
src/effects/GrCircleBlurFragmentProcessor.cpp
src/effects/GrCircleBlurFragmentProcessor.h
src/effects/SkArithmeticImageFilter.cpp
src/effects/SkBlurMaskFilter.cpp
src/effects/SkDisplacementMapEffect.cpp
src/effects/SkLightingImageFilter.cpp
src/effects/SkLumaColorFilter.cpp
src/effects/SkMagnifierImageFilter.cpp
src/effects/SkMorphologyImageFilter.cpp
src/effects/SkOverdrawColorFilter.cpp
src/effects/SkPerlinNoiseShader.cpp
src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
src/effects/SkTableColorFilter.cpp
src/effects/gradients/SkGradientShader.cpp
src/effects/gradients/SkGradientShaderPriv.h
src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
src/gpu/GrDefaultGeoProcFactory.cpp
src/gpu/GrFragmentProcessor.cpp
src/gpu/GrPipelineInput.h [new file with mode: 0644]
src/gpu/GrPrimitiveProcessor.h
src/gpu/GrProcOptInfo.h
src/gpu/GrProcessor.cpp
src/gpu/effects/GrBezierEffect.h
src/gpu/effects/GrBicubicEffect.cpp
src/gpu/effects/GrBicubicEffect.h
src/gpu/effects/GrBitmapTextGeoProc.cpp
src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
src/gpu/effects/GrConfigConversionEffect.cpp
src/gpu/effects/GrConfigConversionEffect.h
src/gpu/effects/GrConstColorProcessor.cpp
src/gpu/effects/GrConvexPolyEffect.cpp
src/gpu/effects/GrConvexPolyEffect.h
src/gpu/effects/GrCustomXfermode.cpp
src/gpu/effects/GrDistanceFieldGeoProc.cpp
src/gpu/effects/GrDitherEffect.cpp
src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
src/gpu/effects/GrMatrixConvolutionEffect.h
src/gpu/effects/GrOvalEffect.cpp
src/gpu/effects/GrRRectEffect.cpp
src/gpu/effects/GrSRGBEffect.cpp
src/gpu/effects/GrSRGBEffect.h
src/gpu/effects/GrSimpleTextureEffect.cpp
src/gpu/effects/GrSimpleTextureEffect.h
src/gpu/effects/GrSingleTextureEffect.h
src/gpu/effects/GrTextureDomain.cpp
src/gpu/effects/GrTextureDomain.h
src/gpu/effects/GrXfermodeFragmentProcessor.cpp
src/gpu/effects/GrYUVEffect.cpp
src/gpu/ops/GrAAConvexPathRenderer.cpp
src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
src/gpu/ops/GrAnalyticRectOp.cpp
src/gpu/ops/GrDashOp.cpp
src/gpu/ops/GrOvalOpFactory.cpp
src/gpu/ops/GrPLSPathRenderer.cpp
tests/GLProgramsTest.cpp
tests/GpuColorFilterTest.cpp [deleted file]
tests/ImageStorageTest.cpp
tests/ProcessorTest.cpp

index 06589f2..9422261 100644 (file)
@@ -19,7 +19,6 @@
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "SkGr.h"
 #include "effects/GrConstColorProcessor.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -669,10 +668,6 @@ private:
                fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataInit;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     GrPerlinNoise2Effect(SkPerlinNoiseShader2::Type type, int numOctaves, bool stitchTiles,
                          SkPerlinNoiseShader2::PaintingData* paintingData,
                          GrTexture* permutationsTexture, GrTexture* noiseTexture,
@@ -1082,10 +1077,6 @@ private:
                fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     GrImprovedPerlinNoiseEffect(int octaves, SkScalar z,
                                 SkPerlinNoiseShader2::PaintingData* paintingData,
                                 GrTexture* permutationsTexture, GrTexture* gradientTexture,
index 001e6c1..db3ebc6 100644 (file)
@@ -20,7 +20,6 @@ skia_gpu_sources = [
   "$_include/gpu/GrCoordTransform.h",
   "$_include/gpu/GrFragmentProcessor.h",
   "$_include/gpu/GrGpuResource.h",
-  "$_include/gpu/GrInvariantOutput.h",
   "$_include/gpu/GrPaint.h",
   "$_include/gpu/GrProcessor.h",
   "$_include/gpu/GrProcessorUnitTest.h",
@@ -143,6 +142,7 @@ skia_gpu_sources = [
   "$_src/gpu/GrPipeline.h",
   "$_src/gpu/GrPipelineBuilder.cpp",
   "$_src/gpu/GrPipelineBuilder.h",
+  "$_src/gpu/GrPipelineInput.h",
   "$_src/gpu/GrPrimitiveProcessor.cpp",
   "$_src/gpu/GrPrimitiveProcessor.h",
   "$_src/gpu/GrProcessorSet.cpp",
index f0c3f0e..b5ad9cc 100644 (file)
@@ -78,7 +78,6 @@ tests_sources = [
   "$_tests/GeometryTest.cpp",
   "$_tests/GifTest.cpp",
   "$_tests/GLProgramsTest.cpp",
-  "$_tests/GpuColorFilterTest.cpp",
   "$_tests/GpuDrawPathTest.cpp",
   "$_tests/GpuLayerCacheTest.cpp",
   "$_tests/GpuRectanizerTest.cpp",
index 202e7fa..96ca1c8 100644 (file)
@@ -138,18 +138,6 @@ public:
     bool isEqual(const GrFragmentProcessor& that) const;
 
     /**
-     * This function is used to perform optimizations. When called the invarientOuput param
-     * indicate whether the input components to this processor in the FS will have known values.
-     * In inout the validFlags member is a bitfield of GrColorComponentFlags. The isSingleComponent
-     * member indicates whether the input will be 1 or 4 bytes. The function updates the members of
-     * inout to indicate known values of its output. A component of the color member only has
-     * meaning if the corresponding bit in validFlags is set.
-     */
-    void computeInvariantOutput(GrInvariantOutput* inout) const {
-        this->onComputeInvariantOutput(inout);
-    }
-
-    /**
      * Pre-order traversal of a FP hierarchy, or of the forest of FPs in a GrPipeline. In the latter
      * case the tree rooted at each FP in the GrPipeline is visited successively.
      */
@@ -278,14 +266,6 @@ protected:
     int registerChildProcessor(sk_sp<GrFragmentProcessor> child);
 
     /**
-     * Subclass implements this to support getConstantColorComponents(...).
-     *
-     * Note: it's up to the subclass implementation to do any recursive call to compute the child
-     * procs' output invariants; computeInvariantOutput will not be recursive.
-     */
-    virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0;
-
-    /**
      * Sub-classes should call this in their constructors if they need access to a distance
      * vector field to the nearest edge
      */
diff --git a/include/gpu/GrInvariantOutput.h b/include/gpu/GrInvariantOutput.h
deleted file mode 100644 (file)
index ee43359..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrInvariantOutput_DEFINED
-#define GrInvariantOutput_DEFINED
-
-#include "GrColor.h"
-
-/**
- * This describes the color or coverage input that will be seen by the first color or coverage stage
- * of a GrPipeline. This is also the GrPrimitiveProcessor color or coverage *output*.
- */
-struct GrPipelineInput {
-    GrPipelineInput()
-            : fValidFlags(kNone_GrColorComponentFlags)
-            , fColor(0)
-            , fIsLCDCoverage(false) {}
-
-    void setKnownFourComponents(GrColor color) {
-        fColor = color;
-        fValidFlags = kRGBA_GrColorComponentFlags;
-    }
-
-    void setUnknownFourComponents() {
-        fValidFlags = kNone_GrColorComponentFlags;
-    }
-
-    void setUnknownOpaqueFourComponents() {
-        fColor = 0xffU << GrColor_SHIFT_A;
-        fValidFlags = kA_GrColorComponentFlag;
-    }
-
-    void setKnownSingleComponent(uint8_t alpha) {
-        fColor = GrColorPackRGBA(alpha, alpha, alpha, alpha);
-        fValidFlags = kRGBA_GrColorComponentFlags;
-    }
-
-    void setUnknownSingleComponent() {
-        fValidFlags = kNone_GrColorComponentFlags;
-    }
-
-    void setUsingLCDCoverage() { fIsLCDCoverage = true; }
-
-    GrColorComponentFlags   fValidFlags;
-    GrColor                 fColor;
-    bool                    fIsLCDCoverage; // Temorary data member until texture pixel configs are
-                                            // updated
-};
-
-/** This describes the output of a GrFragmentProcessor in a GrPipeline. */
-class GrInvariantOutput {
-public:
-    GrInvariantOutput(GrColor color, GrColorComponentFlags flags)
-            : fColor(color), fValidFlags(flags), fNonMulStageFound(false) {}
-
-    GrInvariantOutput(const GrPipelineInput& input)
-            : fColor(input.fColor), fValidFlags(input.fValidFlags), fNonMulStageFound(false) {}
-
-    virtual ~GrInvariantOutput() {}
-
-    void mulByUnknownOpaqueFourComponents() {
-        if (this->isOpaque()) {
-            fValidFlags = kA_GrColorComponentFlag;
-        } else {
-            // Since the current state is not opaque we no longer care if the color being
-            // multiplied is opaque.
-            this->mulByUnknownFourComponents();
-        }
-    }
-
-    void mulByUnknownFourComponents() {
-        if (this->hasZeroAlpha()) {
-            this->internalSetToTransparentBlack();
-        } else {
-            this->internalSetToUnknown();
-        }
-    }
-
-    void mulByUnknownSingleComponent() {
-        if (this->hasZeroAlpha()) {
-            this->internalSetToTransparentBlack();
-        } else {
-            // We don't need to change fIsSingleComponent in this case
-            fValidFlags = kNone_GrColorComponentFlags;
-        }
-    }
-
-    void mulByKnownSingleComponent(uint8_t alpha) {
-        if (this->hasZeroAlpha() || 0 == alpha) {
-            this->internalSetToTransparentBlack();
-        } else {
-            if (alpha != 255) {
-                // Multiply color by alpha
-                fColor = GrColorPackRGBA(SkMulDiv255Round(GrColorUnpackR(fColor), alpha),
-                                         SkMulDiv255Round(GrColorUnpackG(fColor), alpha),
-                                         SkMulDiv255Round(GrColorUnpackB(fColor), alpha),
-                                         SkMulDiv255Round(GrColorUnpackA(fColor), alpha));
-                // We don't need to change fIsSingleComponent in this case
-            }
-        }
-    }
-
-    void mulByKnownFourComponents(GrColor color) {
-        uint32_t a;
-        if (GetAlphaAndCheckSingleChannel(color, &a)) {
-            this->mulByKnownSingleComponent(a);
-        } else {
-            if (color != 0xffffffff) {
-                fColor = GrColorPackRGBA(
-                    SkMulDiv255Round(GrColorUnpackR(fColor), GrColorUnpackR(color)),
-                    SkMulDiv255Round(GrColorUnpackG(fColor), GrColorUnpackG(color)),
-                    SkMulDiv255Round(GrColorUnpackB(fColor), GrColorUnpackB(color)),
-                    SkMulDiv255Round(GrColorUnpackA(fColor), a));
-            }
-        }
-    }
-
-    // Ignores the incoming color's RGB and muls its alpha by color.
-    void mulAlphaByKnownFourComponents(GrColor color) {
-        uint32_t a;
-        if (GetAlphaAndCheckSingleChannel(color, &a)) {
-            this->mulAlphaByKnownSingleComponent(a);
-        } else if (fValidFlags & kA_GrColorComponentFlag) {
-            GrColor preAlpha = GrColorUnpackA(fColor);
-            if (0 == preAlpha) {
-                this->internalSetToTransparentBlack();
-            } else {
-                // We know that color has different component values
-                fColor = GrColorPackRGBA(
-                    SkMulDiv255Round(preAlpha, GrColorUnpackR(color)),
-                    SkMulDiv255Round(preAlpha, GrColorUnpackG(color)),
-                    SkMulDiv255Round(preAlpha, GrColorUnpackB(color)),
-                    SkMulDiv255Round(preAlpha, a));
-                fValidFlags = kRGBA_GrColorComponentFlags;
-            }
-        } else {
-            fValidFlags = kNone_GrColorComponentFlags;
-        }
-    }
-
-    // Ignores the incoming color's RGB and muls its alpha by the alpha param and sets all channels
-    // equal to that value.
-    void mulAlphaByKnownSingleComponent(uint8_t alpha) {
-        if (0 == alpha || this->hasZeroAlpha()) {
-            this->internalSetToTransparentBlack();
-        } else {
-            if (fValidFlags & kA_GrColorComponentFlag) {
-                GrColor a = GrColorUnpackA(fColor);
-                a = SkMulDiv255Round(alpha, a);
-                fColor = GrColorPackRGBA(a, a, a, a);
-                fValidFlags = kRGBA_GrColorComponentFlags;
-            } else {
-                fValidFlags = kNone_GrColorComponentFlags;
-            }
-        }
-    }
-
-    void premulFourChannelColor() {
-        fNonMulStageFound = true;
-        if (!(fValidFlags & kA_GrColorComponentFlag)) {
-            fValidFlags = kNone_GrColorComponentFlags;
-        } else {
-            fColor = GrPremulColor(fColor);
-        }
-    }
-
-    void invalidateComponents(GrColorComponentFlags invalidateFlags) {
-        fValidFlags = (fValidFlags & ~invalidateFlags);
-        fNonMulStageFound = true;
-    }
-
-    void setToOther(GrColorComponentFlags validFlags, GrColor color) {
-        fValidFlags = validFlags;
-        fColor = color;
-        fNonMulStageFound = true;
-    }
-
-    void setToUnknown() {
-        this->internalSetToUnknown();
-        fNonMulStageFound = true;
-    }
-
-    GrColor color() const { return fColor; }
-    GrColorComponentFlags validFlags() const { return fValidFlags; }
-
-private:
-    friend class GrProcOptInfo;
-
-    /** Extracts the alpha channel and returns true if r,g,b == a. */
-    static bool GetAlphaAndCheckSingleChannel(GrColor color, uint32_t* alpha) {
-        *alpha = GrColorUnpackA(color);
-        return *alpha == GrColorUnpackR(color) && *alpha == GrColorUnpackG(color) &&
-               *alpha == GrColorUnpackB(color);
-    }
-
-    void reset(GrColor color, GrColorComponentFlags flags) {
-        fColor = color;
-        fValidFlags = flags;
-        fNonMulStageFound = false;
-    }
-
-    void reset(const GrPipelineInput& input) {
-        fColor = input.fColor;
-        fValidFlags = input.fValidFlags;
-        fNonMulStageFound = false;
-    }
-
-    void internalSetToTransparentBlack() {
-        fValidFlags = kRGBA_GrColorComponentFlags;
-        fColor = 0;
-    }
-
-    void internalSetToUnknown() {
-        fValidFlags = kNone_GrColorComponentFlags;
-    }
-
-    bool hasZeroAlpha() const {
-        return ((fValidFlags & kA_GrColorComponentFlag) && 0 == GrColorUnpackA(fColor));
-    }
-
-    bool isOpaque() const {
-        return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(fColor));
-    }
-
-    bool isSolidWhite() const {
-        return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fColor);
-    }
-
-    bool allStagesMulInput() const { return !fNonMulStageFound; }
-    void resetNonMulStageFound() { fNonMulStageFound = false; }
-
-    /**
-     * If alpha is valid, check that any valid R,G,B values are <= A
-     */
-    SkDEBUGCODE(bool validPreMulColor() const;)
-
-    GrColor fColor;
-    GrColorComponentFlags fValidFlags;
-    bool fNonMulStageFound;
-};
-
-#endif
-
index c9dd276..d0864ed 100644 (file)
@@ -58,8 +58,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     Mode   fMode;
index b32421b..44e8cb1 100644 (file)
@@ -65,7 +65,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
     GrColor4f constantOutputForConstantInput(GrColor4f input) const override;
 
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
index 0c6318b..6809890 100644 (file)
@@ -270,7 +270,6 @@ SkColorMatrixFilterRowMajor255::makeComposed(sk_sp<SkColorFilter> innerFilter) c
 
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -367,50 +366,6 @@ private:
         return 0 == memcmp(fMatrix, cme.fMatrix, sizeof(fMatrix));
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // We only bother to check whether the alpha channel will be constant. If SkColorMatrix had
-        // type flags it might be worth checking the other components.
-
-        // The matrix is defined such the 4th row determines the output alpha. The first four
-        // columns of that row multiply the input r, g, b, and a, respectively, and the last column
-        // is the "translation".
-        static const uint32_t kRGBAFlags[] = {
-            kR_GrColorComponentFlag,
-            kG_GrColorComponentFlag,
-            kB_GrColorComponentFlag,
-            kA_GrColorComponentFlag
-        };
-        static const int kShifts[] = {
-            GrColor_SHIFT_R, GrColor_SHIFT_G, GrColor_SHIFT_B, GrColor_SHIFT_A,
-        };
-        enum {
-            kAlphaRowStartIdx = 15,
-            kAlphaRowTranslateIdx = 19,
-        };
-
-        SkScalar outputA = 0;
-        for (int i = 0; i < 4; ++i) {
-            // If any relevant component of the color to be passed through the matrix is non-const
-            // then we can't know the final result.
-            if (0 != fMatrix[kAlphaRowStartIdx + i]) {
-                if (!(inout->validFlags() & kRGBAFlags[i])) {
-                    inout->setToUnknown();
-                    return;
-                } else {
-                    uint32_t component = (inout->color() >> kShifts[i]) & 0xFF;
-                    outputA += fMatrix[kAlphaRowStartIdx + i] * component;
-                }
-            }
-        }
-        outputA += fMatrix[kAlphaRowTranslateIdx];
-        // We pin the color to [0,1]. This would happen to the *final* color output from the frag
-        // shader but currently the effect does not pin its own output. So in the case of over/
-        // underflow this may deviate from the actual result. Maybe the effect should pin its
-        // result if the matrix could over/underflow for any component?
-        inout->setToOther(kA_GrColorComponentFlag,
-                          static_cast<uint8_t>(SkScalarPin(outputA, 0, 255)) << GrColor_SHIFT_A);
-    }
-
     SkScalar fMatrix[20];
 
     typedef GrFragmentProcessor INHERITED;
index 5bdaee5..2deacc2 100644 (file)
@@ -100,7 +100,6 @@ private:
 
 #include "GrCoordTransform.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -241,10 +240,6 @@ public:
 
     const char* name() const override { return "LightingFP"; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->mulByUnknownFourComponents();
-    }
-
     const SkTArray<SkLights::Light>& directionalLights() const { return fDirectionalLights; }
     const SkColor3f& ambientColor() const { return fAmbientColor; }
 
index 05dfbff..d074482 100644 (file)
@@ -106,7 +106,6 @@ bool SkModeColorFilter::onAppendStages(SkRasterPipeline* p,
 ///////////////////////////////////////////////////////////////////////////////
 #if SK_SUPPORT_GPU
 #include "GrBlend.h"
-#include "GrInvariantOutput.h"
 #include "effects/GrXfermodeFragmentProcessor.h"
 #include "effects/GrConstColorProcessor.h"
 #include "SkGr.h"
@@ -129,10 +128,7 @@ sk_sp<GrFragmentProcessor> SkModeColorFilter::asFragmentProcessor(
     // With a solid color input this should always be able to compute the blended color
     // (at least for coeff modes)
     if ((unsigned)fMode <= (unsigned)SkBlendMode::kLastCoeffMode) {
-        static SkRandom gRand;
-        GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColorComponentFlags);
-        fp->computeInvariantOutput(&io);
-        SkASSERT(io.validFlags() == kRGBA_GrColorComponentFlags);
+        SkASSERT(fp->hasConstantOutputForConstantInput());
     }
 #endif
     return fp;
index 5ff7d82..39e25e0 100644 (file)
@@ -15,7 +15,6 @@
 #include "SkWriteBuffer.h"
 
 #if SK_SUPPORT_GPU
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "SkGr.h"
@@ -224,10 +223,6 @@ public:
 
     const char* name() const override { return "NormalBevelFP"; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
 private:
     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new GLSLNormalBevelFP; }
 
index 73ef549..c08813d 100644 (file)
@@ -15,7 +15,6 @@
 #include "SkWriteBuffer.h"
 
 #if SK_SUPPORT_GPU
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 
@@ -50,9 +49,7 @@ private:
     void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
         GLSLNormalFlatFP::GenKey(*this, caps, b);
     }
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
+
     GrColor4f constantOutputForConstantInput(GrColor4f) const override {
         return GrColor4f(0, 0, 1, 0);
     }
index 2d3d241..afa4698 100644 (file)
@@ -18,7 +18,6 @@
 
 #if SK_SUPPORT_GPU
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "GrSamplerParams.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -103,10 +102,6 @@ public:
 
     const char* name() const override { return "NormalMapFP"; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     const SkMatrix& invCTM() const { return fInvCTM; }
 
 private:
index b56d61e..0cc60f1 100644 (file)
@@ -219,9 +219,6 @@ public:
 
     const char* name() const override { return "RadialShadowMapFP"; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->mulByUnknownFourComponents();
-    }
     const SkVector3& lightPos() const {
         return fLightPos;
     }
index 80794da..afefa95 100644 (file)
@@ -558,9 +558,6 @@ public:
 
     const char* name() const override { return "shadowFP"; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->mulByUnknownFourComponents();
-    }
     int32_t numLights() const { return fNumNonAmbLights; }
     const SkColor3f& ambientColor() const { return fAmbientColor; }
     bool isPointLight(int i) const {
index 45a7b65..f0338a6 100644 (file)
@@ -9,9 +9,7 @@
 
 #if SK_SUPPORT_GPU
 
-#include "GrInvariantOutput.h"
 #include "SkRefCnt.h"
-
 #include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -71,17 +69,6 @@ bool GrAlphaThresholdFragmentProcessor::onIsEqual(const GrFragmentProcessor& sBa
             this->fOuterThreshold == s.fOuterThreshold);
 }
 
-void GrAlphaThresholdFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    GrPixelConfig config = this->textureSampler(0).texture()->config();
-    if (GrPixelConfigIsAlphaOnly(config)) {
-        inout->mulByUnknownSingleComponent();
-    } else if (GrPixelConfigIsOpaque(config) && fOuterThreshold >= 1.f) {
-        inout->mulByUnknownOpaqueFourComponents();
-    } else {
-        inout->mulByUnknownFourComponents();
-    }
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 class GrGLAlphaThresholdFragmentProcessor : public GrGLSLFragmentProcessor {
index f2c14c6..fe97c7d 100644 (file)
@@ -50,8 +50,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     float fInnerThreshold;
index c54a71c..70c4247 100644 (file)
@@ -10,9 +10,7 @@
 #if SK_SUPPORT_GPU
 
 #include "GrContext.h"
-#include "GrInvariantOutput.h"
 #include "GrTextureProvider.h"
-
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -107,10 +105,6 @@ void GrCircleBlurFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& ca
     return;
 }
 
-void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 // Computes an unnormalized half kernel (right side). Returns the summation of all the half kernel
 // values.
 static float make_unnormalized_half_kernel(float* halfKernel, int halfKernelSize, float sigma) {
index 4e7ed13..f577cc7 100644 (file)
@@ -59,8 +59,6 @@ private:
                fTextureRadius == cbfp.fTextureRadius;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     SkRect              fCircle;
     SkScalar            fSolidRadius;
     float               fTextureRadius;
index 4056069..af834aa 100644 (file)
@@ -285,11 +285,6 @@ private:
                fEnforcePMColor == fp.fEnforcePMColor;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // TODO: optimize this
-        inout->setToUnknown();
-    }
-
     // This could implement the const input -> const output optimization but it's unlikely to help.
     ArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor,
                  sk_sp<GrFragmentProcessor> dst)
index f41648d..c070ccf 100644 (file)
@@ -21,7 +21,6 @@
 #include "GrRenderTargetContext.h"
 #include "GrTexture.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrShaderCaps.h"
 #include "GrStyle.h"
 #include "GrTextureProxy.h"
@@ -823,8 +822,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     static GrTexture* CreateBlurProfileTexture(GrTextureProvider*, float sigma);
 
     SkRect          fRect;
@@ -999,10 +996,6 @@ bool GrRectBlurEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
     return this->getSigma() == s.getSigma() && this->getRect() == s.getRect();
 }
 
-void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect);
 
 #if GR_TEST_UTILS
@@ -1093,8 +1086,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor& other) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     SkRRect             fRRect;
     float               fSigma;
     TextureSampler      fNinePatchSampler;
@@ -1205,10 +1196,6 @@ sk_sp<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context,
                                                             mask.get()));
 }
 
-void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture* ninePatchTexture)
         : INHERITED(kModulatesInput_OptimizationFlag)
         , fRRect(rrect)
index 67fb761..6b9cb2b 100644 (file)
@@ -16,7 +16,6 @@
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "GrRenderTargetContext.h"
 #include "GrTextureProxy.h"
 
@@ -250,8 +249,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
                             SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
                             const SkVector& scale,
@@ -524,15 +521,6 @@ bool GrDisplacementMapEffect::onIsEqual(const GrFragmentProcessor& sBase) const
            fScale == s.fScale;
 }
 
-void GrDisplacementMapEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    // Any displacement offset bringing a pixel out of bounds will output a color of (0,0,0,0),
-    // so the only way we'd get a constant alpha is if the input color image has a constant alpha
-    // and no displacement offset push any texture coordinates out of bounds OR if the constant
-    // alpha is 0. Since this isn't trivial to compute at this point, let's assume the output is
-    // not of constant color when a displacement effect is applied.
-    inout->setToUnknown();
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect);
index fc7b29b..5108724 100644 (file)
@@ -18,7 +18,6 @@
 #include "GrContext.h"
 #include "GrFixedClip.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrPaint.h"
 #include "GrRenderTargetContext.h"
 #include "GrTextureProxy.h"
@@ -558,10 +557,6 @@ public:
 protected:
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // lighting shaders are complicated. We just throw up our hands.
-        inout->mulByUnknownFourComponents();
-    }
 
 private:
     const SkImageFilterLight* fLight;
index 1792437..2809c8b 100644 (file)
@@ -13,7 +13,6 @@
 
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #endif
@@ -113,10 +112,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // The output is always black. The alpha value for the color passed in is arbitrary.
-        inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0));
-    }
     GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
         float luma = SK_ITU_BT709_LUM_COEFF_R * input.fRGBA[0] +
                      SK_ITU_BT709_LUM_COEFF_G * input.fRGBA[1] +
index 93a6710..d62ce9c 100644 (file)
@@ -17,7 +17,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
-#include "GrInvariantOutput.h"
 #include "effects/GrSingleTextureEffect.h"
 #include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -88,8 +87,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     SkRect fBounds;
@@ -251,10 +248,6 @@ bool GrMagnifierEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
             this->fYInvInset == s.fYInvInset);
 }
 
-void GrMagnifierEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    this->updateInvariantOutputForModulation(inout);
-}
-
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
index 2c813e2..bf92b4f 100644 (file)
@@ -18,7 +18,6 @@
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
 #include "GrFixedClip.h"
-#include "GrInvariantOutput.h"
 #include "GrRenderTargetContext.h"
 #include "GrTexture.h"
 #include "GrTextureProxy.h"
@@ -177,8 +176,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType);
     GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType, const float bounds[2]);
 
@@ -363,12 +360,6 @@ bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
             this->type() == s.type());
 }
 
-void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    // This is valid because the color components of the result of the kernel all come
-    // exactly from existing values in the source texture.
-    this->updateInvariantOutputForModulation(inout);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect);
index 243ef77..7c5212d 100644 (file)
@@ -50,7 +50,6 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
 #if SK_SUPPORT_GPU
 
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 
@@ -63,7 +62,6 @@ private:
     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
     bool onIsEqual(const GrFragmentProcessor&) const override;
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
 
     OverdrawFragmentProcessor(const GrColor4f* colors);
 
@@ -122,10 +120,6 @@ bool OverdrawFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) cons
                        sizeof(GrColor4f) * SkOverdrawColorFilter::kNumColors);
 }
 
-void OverdrawFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->invalidateComponents(kRGBA_GrColorComponentFlags);
-}
-
 GLOverdrawFragmentProcessor::GLOverdrawFragmentProcessor(const GrColor4f* colors) {
     memcpy(fColors, colors, SkOverdrawColorFilter::kNumColors * sizeof(GrColor4f));
 }
index 7582196..668ca6c 100644 (file)
@@ -18,7 +18,6 @@
 #if SK_SUPPORT_GPU
 #include "GrContext.h"
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "SkGr.h"
 #include "effects/GrConstColorProcessor.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -532,10 +531,6 @@ private:
                fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataInit;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, int numOctaves, bool stitchTiles,
                         SkPerlinNoiseShader::PaintingData* paintingData,
                         GrTexture* permutationsTexture, GrTexture* noiseTexture,
index 223887b..7635759 100644 (file)
@@ -190,7 +190,6 @@ bool SkRRectsGaussianEdgeMaskFilterImpl::filterMask(SkMask* dst, const SkMask& s
 
 #include "GrCoordTransform.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -453,10 +452,6 @@ public:
 
     const char* name() const override { return "RRectsGaussianEdgeFP"; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     const SkRRect& first() const { return fFirst; }
     Mode firstMode() const { return fFirstMode; }
     const SkRRect& second() const { return fSecond; }
index 7de1008..8960449 100644 (file)
@@ -361,7 +361,6 @@ sk_sp<SkColorFilter> SkTable_ColorFilter::makeComposed(sk_sp<SkColorFilter> inne
 
 #include "GrContext.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrTextureStripAtlas.h"
 #include "SkGr.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -387,19 +386,13 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row, unsigned flags);
 
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
-    TextureSampler          fTextureSampler;
-
-    // currently not used in shader code, just to assist onComputeInvariantOutput().
-    unsigned                fFlags;
-
-    GrTextureStripAtlas*    fAtlas;
-    int                     fRow;
+    TextureSampler fTextureSampler;
+    GrTextureStripAtlas* fAtlas;
+    int fRow;
 
     typedef GrFragmentProcessor INHERITED;
 };
@@ -514,7 +507,6 @@ ColorTableEffect::ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atla
                                    unsigned flags)
         : INHERITED(kNone_OptimizationFlags)  // Not bothering with table-specific optimizations.
         , fTextureSampler(texture)
-        , fFlags(flags)
         , fAtlas(atlas)
         , fRow(row) {
     this->initClassID<ColorTableEffect>();
@@ -546,25 +538,6 @@ bool ColorTableEffect::onIsEqual(const GrFragmentProcessor& other) const {
     return fRow == that.fRow;
 }
 
-void ColorTableEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    // If we kept the table in the effect then we could actually run known inputs through the
-    // table.
-    GrColorComponentFlags invalidateFlags = kNone_GrColorComponentFlags;
-    if (fFlags & SkTable_ColorFilter::kR_Flag) {
-        invalidateFlags |= kR_GrColorComponentFlag;
-    }
-    if (fFlags & SkTable_ColorFilter::kG_Flag) {
-        invalidateFlags |= kG_GrColorComponentFlag;
-    }
-    if (fFlags & SkTable_ColorFilter::kB_Flag) {
-        invalidateFlags |= kB_GrColorComponentFlag;
-    }
-    if (fFlags & SkTable_ColorFilter::kA_Flag) {
-        invalidateFlags |= kA_GrColorComponentFlag;
-    }
-    inout->invalidateComponents(invalidateFlags);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect);
index 9b38cb5..03f0cbc 100644 (file)
@@ -1121,7 +1121,6 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
 #if SK_SUPPORT_GPU
 
 #include "GrContext.h"
-#include "GrInvariantOutput.h"
 #include "GrShaderCaps.h"
 #include "GrTextureStripAtlas.h"
 #include "gl/GrGLContext.h"
@@ -1744,14 +1743,6 @@ bool GrGradientEffect::onIsEqual(const GrFragmentProcessor& processor) const {
     return GrColorSpaceXform::Equals(this->fColorSpaceXform.get(), ge.fColorSpaceXform.get());
 }
 
-void GrGradientEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    if (fIsOpaque) {
-        inout->mulByUnknownOpaqueFourComponents();
-    } else {
-        inout->mulByUnknownFourComponents();
-    }
-}
-
 #if GR_TEST_UTILS
 GrGradientEffect::RandomGradientParams::RandomGradientParams(SkRandom* random) {
     // Set color count to min of 2 so that we don't trigger the const color optimization and make
index fe238ff..1e34153 100644 (file)
@@ -427,8 +427,6 @@ protected:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     const GrCoordTransform& getCoordTransform() const { return fCoordTransform; }
 
 private:
index a301d64..bf92299 100644 (file)
@@ -10,7 +10,6 @@
 
 #if SK_SUPPORT_GPU
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "GrPaint.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
index f371e24..90d3239 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "GrDefaultGeoProcFactory.h"
 
-#include "GrInvariantOutput.h"
 #include "SkRefCnt.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLGeometryProcessor.h"
index 07bbe7b..9ff426f 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "GrPipeline.h"
 #include "GrProcOptInfo.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -137,9 +136,6 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::PremulInput(sk_sp<GrFragmentProc
 
         bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
 
-        void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-            inout->premulFourChannelColor();
-        }
         GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
             return input.premul();
         }
@@ -195,38 +191,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::MakeInputPremulAndMulByOutput(
             }
             return flags;
         }
-        void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-            // TODO: Add a helper to GrInvariantOutput that handles multiplying by color with flags?
-            if (!(inout->validFlags() & kA_GrColorComponentFlag)) {
-                inout->setToUnknown();
-                return;
-            }
-
-            GrInvariantOutput childOutput(GrColor_WHITE, kRGBA_GrColorComponentFlags);
-            this->childProcessor(0).computeInvariantOutput(&childOutput);
 
-            if (0 == GrColorUnpackA(inout->color()) || 0 == GrColorUnpackA(childOutput.color())) {
-                inout->mulByKnownFourComponents(0x0);
-                return;
-            }
-            GrColorComponentFlags commonFlags = childOutput.validFlags() & inout->validFlags();
-            GrColor c0 = GrPremulColor(inout->color());
-            GrColor c1 = childOutput.color();
-            GrColor color = 0x0;
-            if (commonFlags & kR_GrColorComponentFlag) {
-                color |= SkMulDiv255Round(GrColorUnpackR(c0), GrColorUnpackR(c1)) <<
-                    GrColor_SHIFT_R;
-            }
-            if (commonFlags & kG_GrColorComponentFlag) {
-                color |= SkMulDiv255Round(GrColorUnpackG(c0), GrColorUnpackG(c1)) <<
-                    GrColor_SHIFT_G;
-            }
-            if (commonFlags & kB_GrColorComponentFlag) {
-                color |= SkMulDiv255Round(GrColorUnpackB(c0), GrColorUnpackB(c1)) <<
-                    GrColor_SHIFT_B;
-            }
-            inout->setToOther(commonFlags, color);
-        }
         GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
             GrColor4f childColor = ConstantOutputForConstantInput(this->childProcessor(0),
                                                                   GrColor4f::OpaqueWhite());
@@ -310,11 +275,6 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
             return fColor == that.cast<ReplaceInputFragmentProcessor>().fColor;
         }
 
-        void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-            inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor());
-            this->childProcessor(0).computeInvariantOutput(inout);
-        }
-
         GrColor4f constantOutputForConstantInput(GrColor4f) const override {
             return ConstantOutputForConstantInput(this->childProcessor(0), fColor);
         }
@@ -324,8 +284,6 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
         typedef GrFragmentProcessor INHERITED;
     };
 
-    GrInvariantOutput childOut(0x0, kNone_GrColorComponentFlags);
-    fp->computeInvariantOutput(&childOut);
     return sk_sp<GrFragmentProcessor>(new ReplaceInputFragmentProcessor(std::move(fp), color));
 }
 
@@ -375,11 +333,6 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
 
         bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
 
-        void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-            for (int i = 0; i < this->numChildProcessors(); ++i) {
-                this->childProcessor(i).computeInvariantOutput(inout);
-            }
-        }
         GrColor4f constantOutputForConstantInput(GrColor4f color) const override {
             int childCnt = this->numChildProcessors();
             for (int i = 0; i < childCnt; ++i) {
diff --git a/src/gpu/GrPipelineInput.h b/src/gpu/GrPipelineInput.h
new file mode 100644 (file)
index 0000000..43d88d0
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrPipelineInput_DEFINED
+#define GrPipelineInput_DEFINED
+
+#include "GrColor.h"
+
+/**
+ * This describes the color or coverage input that will be seen by the first color or coverage stage
+ * of a GrPipeline. This is also the GrPrimitiveProcessor color or coverage *output*.
+ */
+struct GrPipelineInput {
+    GrPipelineInput()
+            : fValidFlags(kNone_GrColorComponentFlags), fColor(0), fIsLCDCoverage(false) {}
+
+    void setKnownFourComponents(GrColor color) {
+        fColor = color;
+        fValidFlags = kRGBA_GrColorComponentFlags;
+    }
+
+    void setUnknownFourComponents() { fValidFlags = kNone_GrColorComponentFlags; }
+
+    void setUnknownOpaqueFourComponents() {
+        fColor = 0xffU << GrColor_SHIFT_A;
+        fValidFlags = kA_GrColorComponentFlag;
+    }
+
+    void setKnownSingleComponent(uint8_t alpha) {
+        fColor = GrColorPackRGBA(alpha, alpha, alpha, alpha);
+        fValidFlags = kRGBA_GrColorComponentFlags;
+    }
+
+    void setUnknownSingleComponent() { fValidFlags = kNone_GrColorComponentFlags; }
+
+    void setUsingLCDCoverage() { fIsLCDCoverage = true; }
+
+    GrColorComponentFlags fValidFlags;
+    GrColor fColor;
+    bool fIsLCDCoverage;
+};
+
+#endif
index f1af14d..9f726d2 100644 (file)
  * functionality.
  *
  * There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the
- * GrPrimitiveProcessor.  These loops run on the CPU and compute any invariant components which
- * might be useful for correctness / optimization decisions.  The GrPrimitiveProcessor seeds these
- * loops, one with initial color and one with initial coverage, in its
- * onComputeInvariantColor / Coverage calls.  These seed values are processed by the subsequent
+ * GrPrimitiveProcessor. These loops run on the CPU and to determine known properties of the final
+ * color and coverage inputs to the GrXferProcessor in order to perform optimizations that preserve
+ * correctness. The GrDrawOp seeds these loops with initial color and coverage, in its
+ * getPipelineAnalysisInput implementation. These seed values are processed by the subsequent
  * stages of the rendering pipeline and the output is then fed back into the GrDrawOp in
  * the applyPipelineOptimizations call, where the op can use the information to inform decisions
  * about GrPrimitiveProcessor creation.
index be46712..89b4d2c 100644 (file)
@@ -9,7 +9,7 @@
 #define GrProcOptInfo_DEFINED
 
 #include "GrColor.h"
-#include "GrInvariantOutput.h"
+#include "GrPipelineInput.h"
 
 class GrDrawOp;
 class GrFragmentProcessor;
index 897a755..663527e 100644 (file)
@@ -8,7 +8,6 @@
 #include "GrProcessor.h"
 #include "GrContext.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrMemoryPool.h"
 #include "GrSamplerParams.h"
 #include "GrTexturePriv.h"
index 824883c..f908551 100644 (file)
@@ -11,7 +11,6 @@
 #include "GrCaps.h"
 #include "GrProcessor.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrTypesPriv.h"
 
 /**
index 2499c20..5f06fc1 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "GrBicubicEffect.h"
-#include "GrInvariantOutput.h"
 #include "GrProxyMove.h"
 #include "GrTextureProxy.h"
 #include "glsl/GrGLSLColorSpaceXformHelper.h"
@@ -196,11 +195,6 @@ bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
     return fDomain == s.fDomain;
 }
 
-void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    // FIXME: Perhaps we can do better.
-    inout->mulByUnknownSingleComponent();
-}
-
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect);
 
 #if GR_TEST_UTILS
index a51aad8..ba80ec2 100644 (file)
@@ -99,8 +99,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GrTextureDomain fDomain;
 
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
index 60df6b9..cb9cfdc 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "GrBitmapTextGeoProc.h"
-#include "GrInvariantOutput.h"
 #include "GrTexture.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLGeometryProcessor.h"
index a4db68d..2d49883 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "effects/GrBlurredEdgeFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -68,8 +67,4 @@ bool GrBlurredEdgeFP::onIsEqual(const GrFragmentProcessor& other) const {
     return that.fMode == fMode;
 }
 
-void GrBlurredEdgeFP::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownFourComponents();
-}
-
 
index 771eba8..ba089fa 100644 (file)
@@ -8,7 +8,6 @@
 #include "GrConfigConversionEffect.h"
 #include "GrContext.h"
 #include "GrRenderTargetContext.h"
-#include "GrInvariantOutput.h"
 #include "GrSimpleTextureEffect.h"
 #include "SkMatrix.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -136,10 +135,6 @@ bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& s) const {
            other.fPMConversion == fPMConversion;
 }
 
-void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    this->updateInvariantOutputForModulation(inout);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect);
index 151365b..afa24c0 100644 (file)
@@ -64,8 +64,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GrSwizzle       fSwizzle;
     PMConversion    fPMConversion;
 
index 1d20512..1013ff3 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "effects/GrConstColorProcessor.h"
-#include "GrInvariantOutput.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -62,29 +61,6 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void GrConstColorProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    if (kIgnore_InputMode == fMode) {
-        inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor());
-    } else {
-        float r = fColor.fRGBA[0];
-        bool colorIsSingleChannel = r == fColor.fRGBA[1] && r == fColor.fRGBA[2] &&
-                                    r == fColor.fRGBA[3];
-        if (kModulateRGBA_InputMode == fMode) {
-            if (colorIsSingleChannel) {
-                inout->mulByKnownSingleComponent(SkToU8(sk_float_round2int(255.0f * r)));
-            } else {
-                inout->mulByKnownFourComponents(fColor.toGrColor());
-            }
-        } else {
-            if (colorIsSingleChannel) {
-                inout->mulAlphaByKnownSingleComponent(SkToU8(sk_float_round2int(255.0f * r)));
-            } else {
-                inout->mulAlphaByKnownFourComponents(fColor.toGrColor());
-            }
-        }
-    }
-}
-
 GrColor4f GrConstColorProcessor::constantOutputForConstantInput(GrColor4f input) const {
     switch (fMode) {
         case kIgnore_InputMode:
index db8c2d9..907a9e5 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "GrConvexPolyEffect.h"
-#include "GrInvariantOutput.h"
 #include "SkPathPriv.h"
 #include "effects/GrConstColorProcessor.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -43,15 +42,6 @@ private:
         return fRect == aare.fRect;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        if (fRect.isEmpty()) {
-            // An empty rect will have no coverage anywhere.
-            inout->mulByKnownSingleComponent(0);
-        } else {
-            inout->mulByUnknownSingleComponent();
-        }
-    }
-
     SkRect              fRect;
     GrPrimitiveEdgeType fEdgeType;
 
@@ -327,10 +317,6 @@ sk_sp<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType edgeType
 
 GrConvexPolyEffect::~GrConvexPolyEffect() {}
 
-void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 void GrConvexPolyEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
                                                GrProcessorKeyBuilder* b) const {
     GrGLConvexPolyEffect::GenKey(*this, caps, b);
index 2d9d20f..b5ae724 100644 (file)
@@ -78,8 +78,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor& other) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GrPrimitiveEdgeType    fEdgeType;
     int                    fEdgeCount;
     SkScalar               fEdges[3 * kMaxEdges];
index e40d184..4a4cb60 100644 (file)
@@ -10,7 +10,6 @@
 #include "GrCoordTransform.h"
 #include "GrContext.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrPipeline.h"
 #include "GrProcessor.h"
 #include "GrShaderCaps.h"
index 0f9625e..9a7e787 100644 (file)
@@ -6,11 +6,8 @@
  */
 
 #include "GrDistanceFieldGeoProc.h"
-#include "GrInvariantOutput.h"
 #include "GrTexture.h"
-
 #include "SkDistanceFieldGen.h"
-
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLGeometryProcessor.h"
 #include "glsl/GrGLSLProgramDataManager.h"
index 34a1565..036d42c 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "GrDitherEffect.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "SkRect.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -35,17 +34,11 @@ private:
     // All dither effects are equal
     bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     typedef GrFragmentProcessor INHERITED;
 };
 
-void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->setToUnknown();
-}
-
 //////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect);
index 0bb9c5e..6d6e5b0 100644 (file)
@@ -9,7 +9,6 @@
 #define GrGaussianConvolutionFragmentProcessor_DEFINED
 
 #include "Gr1DKernelEffect.h"
-#include "GrInvariantOutput.h"
 
 /**
  * A 1D Gaussian convolution effect. The kernel is computed as an array of 2 * half-width weights.
@@ -73,12 +72,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // If the texture was opaque we could know that the output color if we knew the sum of the
-        // kernel values.
-        inout->mulByUnknownFourComponents();
-    }
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     // TODO: Inline the kernel constants into the generated shader code. This may involve pulling
index 0bb7c50..581323b 100644 (file)
@@ -9,7 +9,6 @@
 #define GrMatrixConvolutionEffect_DEFINED
 
 #include "GrSingleTextureEffect.h"
-#include "GrInvariantOutput.h"
 #include "GrTextureDomain.h"
 
 // A little bit less than the minimum # uniforms required by DX9SM2 (32).
@@ -109,11 +108,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // TODO: Try to do better?
-        inout->mulByUnknownFourComponents();
-    }
-
     SkIRect         fBounds;
     SkISize         fKernelSize;
     float           fKernel[MAX_KERNEL_SIZE];
index b64ac56..36db836 100644 (file)
@@ -8,7 +8,6 @@
 #include "GrOvalEffect.h"
 
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "SkRect.h"
 #include "GrShaderCaps.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -42,8 +41,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     SkPoint             fCenter;
     SkScalar            fRadius;
     GrPrimitiveEdgeType    fEdgeType;
@@ -59,10 +56,6 @@ sk_sp<GrFragmentProcessor> CircleEffect::Make(GrPrimitiveEdgeType edgeType, cons
     return sk_sp<GrFragmentProcessor>(new CircleEffect(edgeType, center, radius));
 }
 
-void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkScalar r)
         : INHERITED(kModulatesInput_OptimizationFlag), fCenter(c), fRadius(r), fEdgeType(edgeType) {
     this->initClassID<CircleEffect>();
@@ -207,8 +200,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     SkPoint             fCenter;
     SkVector            fRadii;
     GrPrimitiveEdgeType    fEdgeType;
@@ -226,10 +217,6 @@ sk_sp<GrFragmentProcessor> EllipseEffect::Make(GrPrimitiveEdgeType edgeType,
     return sk_sp<GrFragmentProcessor>(new EllipseEffect(edgeType, center, rx, ry));
 }
 
-void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkScalar rx,
                              SkScalar ry)
         : INHERITED(kModulatesInput_OptimizationFlag)
index dabf11a..29d3d3d 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "GrConvexPolyEffect.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrOvalEffect.h"
 #include "GrShaderCaps.h"
 #include "SkRRect.h"
@@ -68,8 +67,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor& other) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     SkRRect                fRRect;
     GrPrimitiveEdgeType    fEdgeType;
     uint32_t               fCircularCornerFlags;
@@ -89,10 +86,6 @@ sk_sp<GrFragmentProcessor> CircularRRectEffect::Make(GrPrimitiveEdgeType edgeTyp
         new CircularRRectEffect(edgeType, circularCornerFlags, rrect));
 }
 
-void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t circularCornerFlags,
                                          const SkRRect& rrect)
         : INHERITED(kModulatesInput_OptimizationFlag)
@@ -411,8 +404,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor& other) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     SkRRect fRRect;
     GrPrimitiveEdgeType fEdgeType;
 
@@ -429,10 +420,6 @@ EllipticalRRectEffect::Make(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
     return sk_sp<GrFragmentProcessor>(new EllipticalRRectEffect(edgeType, rrect));
 }
 
-void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->mulByUnknownSingleComponent();
-}
-
 EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
         : INHERITED(kModulatesInput_OptimizationFlag), fRRect(rrect), fEdgeType(edgeType) {
     this->initClassID<EllipticalRRectEffect>();
index ad90e70..39d6403 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "GrContext.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrProcessor.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -82,10 +81,6 @@ bool GrSRGBEffect::onIsEqual(const GrFragmentProcessor& s) const {
     return other.fMode == fMode;
 }
 
-void GrSRGBEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    inout->setToUnknown();
-}
-
 static inline float srgb_to_linear(float srgb) {
     return (srgb <= 0.04045f) ? srgb / 12.92f : powf((srgb + 0.055f) / 1.055f, 2.4f);
 }
index 3d05dd6..17afa5e 100644 (file)
@@ -32,7 +32,7 @@ private:
     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
     bool onIsEqual(const GrFragmentProcessor&) const override;
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
+
     GrColor4f constantOutputForConstantInput(GrColor4f input) const override;
 
     Mode fMode;
index 8b63fec..bd4e720 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "GrSimpleTextureEffect.h"
-#include "GrInvariantOutput.h"
 #include "GrProxyMove.h"
 #include "GrTexture.h"
 #include "glsl/GrGLSLColorSpaceXformHelper.h"
@@ -79,10 +78,6 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void GrSimpleTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    this->updateInvariantOutputForModulation(inout);
-}
-
 void GrSimpleTextureEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
                                                   GrProcessorKeyBuilder* b) const {
     GrGLSimpleTextureEffect::GenKey(*this, caps, b);
index 64ca3cb..e7fe8bd 100644 (file)
@@ -111,8 +111,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor& other) const override { return true; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     typedef GrSingleTextureEffect INHERITED;
index 29105b5..894334b 100644 (file)
@@ -11,7 +11,6 @@
 #include "GrFragmentProcessor.h"
 #include "GrColorSpaceXform.h"
 #include "GrCoordTransform.h"
-#include "GrInvariantOutput.h"
 #include "SkMatrix.h"
 
 class GrTexture;
@@ -55,22 +54,6 @@ protected:
                           sk_sp<GrColorSpaceXform>, const SkMatrix&, const GrSamplerParams&);
 
     /**
-     * Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that
-     * the subclass output color will be a modulation of the input color with a value read from the
-     * texture.
-     */
-    void updateInvariantOutputForModulation(GrInvariantOutput* inout) const {
-        GrPixelConfig config = this->textureSampler(0).texture()->config();
-        if (GrPixelConfigIsAlphaOnly(config)) {
-            inout->mulByUnknownSingleComponent();
-        } else if (GrPixelConfigIsOpaque(config)) {
-            inout->mulByUnknownOpaqueFourComponents();
-        } else {
-            inout->mulByUnknownFourComponents();
-        }
-    }
-
-    /**
      * Can be used as a helper to implement subclass onOptimizationFlags(). It assumes that
      * the subclass output color will be a modulation of the input color with a value read from the
      * texture.
index 58707f5..142cd1d 100644 (file)
@@ -8,7 +8,6 @@
 #include "GrTextureDomain.h"
 
 #include "GrContext.h"
-#include "GrInvariantOutput.h"
 #include "GrShaderCaps.h"
 #include "GrSimpleTextureEffect.h"
 #include "GrSurfaceProxyPriv.h"
@@ -359,18 +358,6 @@ bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
     return this->fTextureDomain == s.fTextureDomain;
 }
 
-void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
-    if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) {
-        if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).texture()->config())) {
-            inout->mulByUnknownSingleComponent();
-        } else {
-            inout->mulByUnknownFourComponents();
-        }
-    } else {
-        this->updateInvariantOutputForModulation(inout);
-    }
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect);
@@ -504,15 +491,6 @@ bool GrDeviceSpaceTextureDecalFragmentProcessor::onIsEqual(const GrFragmentProce
            dstdfp.fTextureDomain == fTextureDomain;
 }
 
-void GrDeviceSpaceTextureDecalFragmentProcessor::onComputeInvariantOutput(
-        GrInvariantOutput* inout) const {
-    if (GrPixelConfigIsAlphaOnly(this->textureSampler(0).texture()->config())) {
-        inout->mulByUnknownSingleComponent();
-    } else {
-        inout->mulByUnknownFourComponents();
-    }
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDeviceSpaceTextureDecalFragmentProcessor);
index fbc20f1..f00d460 100644 (file)
@@ -205,8 +205,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
-
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
     typedef GrSingleTextureEffect INHERITED;
@@ -248,7 +246,6 @@ private:
     void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
 
     bool onIsEqual(const GrFragmentProcessor& fp) const override;
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
 
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
index 78918ce..612ebea 100644 (file)
@@ -8,7 +8,6 @@
 #include "effects/GrXfermodeFragmentProcessor.h"
 
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "effects/GrConstColorProcessor.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLBlend.h"
@@ -62,10 +61,6 @@ private:
         return fMode == cs.fMode;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
         float alpha = input.fRGBA[3];
         input = input.opaque();
@@ -216,32 +211,6 @@ private:
         return fMode == that.cast<ComposeOneFragmentProcessor>().fMode;
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        SkXfermode::Coeff skSrcCoeff, skDstCoeff;
-        if (SkXfermode::ModeAsCoeff(fMode, &skSrcCoeff, &skDstCoeff)) {
-            GrBlendCoeff srcCoeff = SkXfermodeCoeffToGrBlendCoeff(skSrcCoeff);
-            GrBlendCoeff dstCoeff = SkXfermodeCoeffToGrBlendCoeff(skDstCoeff);
-            GrInvariantOutput childOutput(0xFFFFFFFF, kRGBA_GrColorComponentFlags);
-            this->childProcessor(0).computeInvariantOutput(&childOutput);
-            GrColor blendColor;
-            GrColorComponentFlags blendFlags;
-            if (kDst_Child == fChild) {
-                GrGetCoeffBlendKnownComponents(srcCoeff, dstCoeff,
-                                               inout->color(), inout->validFlags(),
-                                               childOutput.color(), childOutput.validFlags(),
-                                               &blendColor, &blendFlags);
-            } else {
-                GrGetCoeffBlendKnownComponents(srcCoeff, dstCoeff,
-                                               childOutput.color(), childOutput.validFlags(),
-                                               inout->color(), inout->validFlags(),
-                                               &blendColor, &blendFlags);
-            }
-            inout->setToOther(blendFlags, blendColor);
-        } else {
-            inout->setToUnknown();
-        }
-    }
-
     GrColor4f constantOutputForConstantInput(GrColor4f inputColor) const override {
         GrColor4f childColor =
                 ConstantOutputForConstantInput(this->childProcessor(0), GrColor4f::OpaqueWhite());
index 6d917f3..e09e185 100644 (file)
@@ -10,7 +10,6 @@
 #include "GrContext.h"
 #include "GrCoordTransform.h"
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrProcessor.h"
 #include "GrTextureProxy.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -191,11 +190,6 @@ private:
         return (fColorSpace == s.getColorSpace()) && (fNV12 == s.isNV12());
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // YUV is opaque
-        inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A);
-    }
-
     GrCoordTransform fYTransform;
     TextureSampler   fYSampler;
     GrCoordTransform fUTransform;
@@ -354,10 +348,6 @@ private:
         return fColorSpace == s.getColorSpace() && fOutputChannels == s.outputChannels();
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToUnknown();
-    }
-
     GrCoordTransform    fTransform;
     TextureSampler      fTextureSampler;
     SkYUVColorSpace     fColorSpace;
index 767b7a0..d239732 100644 (file)
@@ -13,7 +13,6 @@
 #include "GrDefaultGeoProcFactory.h"
 #include "GrDrawOpTest.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
 #include "GrPipelineBuilder.h"
index fdb5d7f..0cf08d7 100644 (file)
@@ -12,7 +12,6 @@
 #include "GrDefaultGeoProcFactory.h"
 #include "GrDrawOpTest.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrOpFlushState.h"
 #include "GrPathUtils.h"
 #include "GrPipelineBuilder.h"
index df62e05..23a024b 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "GrDrawOpTest.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrOpFlushState.h"
 #include "GrProcessor.h"
 #include "GrResourceProvider.h"
index 7d7dbf1..dbd319a 100644 (file)
@@ -13,7 +13,6 @@
 #include "GrDefaultGeoProcFactory.h"
 #include "GrDrawOpTest.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrOpFlushState.h"
 #include "GrProcessor.h"
 #include "GrStyle.h"
index 4c00189..a8f0c92 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "GrDrawOpTest.h"
 #include "GrGeometryProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrOpFlushState.h"
 #include "GrProcessor.h"
 #include "GrResourceProvider.h"
index 80a4cda..3df31fb 100644 (file)
@@ -11,7 +11,6 @@
 #include "GrContext.h"
 #include "GrDefaultGeoProcFactory.h"
 #include "GrDrawOpTest.h"
-#include "GrInvariantOutput.h"
 #include "GrOpFlushState.h"
 #include "GrPLSGeometryProcessor.h"
 #include "GrPathUtils.h"
index 19f190e..dc189d6 100644 (file)
@@ -16,7 +16,6 @@
 #include "GrContextPriv.h"
 #include "GrDrawOpTest.h"
 #include "GrDrawingManager.h"
-#include "GrInvariantOutput.h"
 #include "GrPipeline.h"
 #include "GrRenderTargetContextPriv.h"
 #include "GrResourceProvider.h"
@@ -84,7 +83,6 @@ private:
         GLBigKeyProcessor::GenKey(*this, caps, b);
     }
     bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override { }
 
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
 
@@ -132,11 +130,6 @@ private:
 
     bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        inout->setToOther(kRGBA_GrColorComponentFlags, GrColor_WHITE);
-        this->childProcessor(0).computeInvariantOutput(inout);
-    }
-
     typedef GrFragmentProcessor INHERITED;
 };
 
diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp
deleted file mode 100644 (file)
index 5d45141..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkColorFilter.h"
-#include "Test.h"
-
-#if SK_SUPPORT_GPU
-
-#include "GrContext.h"
-#include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
-#include "SkGr.h"
-
-static GrColor filterColor(const GrColor& color, uint32_t flags)  {
-    uint32_t mask = 0;
-    if (flags & kR_GrColorComponentFlag) {
-        mask = 0xFF << GrColor_SHIFT_R;
-    }
-    if (flags & kG_GrColorComponentFlag) {
-        mask |= 0xFF << GrColor_SHIFT_G;
-    }
-    if (flags & kB_GrColorComponentFlag) {
-        mask |= 0xFF << GrColor_SHIFT_B;
-    }
-    if (flags & kA_GrColorComponentFlag) {
-        mask |= 0xFF << GrColor_SHIFT_A;
-    }
-    return color & mask;
-}
-
-DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) {
-    struct GetConstantComponentTestCase {
-        // "Shape drawn with"
-        uint32_t inputComponents; // "rgb of", "red of", "alpha of", ...
-        GrColor inputColor;       // "[color]"
-
-        SkColor filterColor;      // "with filter color [color]"
-        SkBlendMode filterMode; // "in mode [mode]"
-
-        // "produces"
-        uint32_t outputComponents; // "rgb of", "red of", "alpha of", ...
-        GrColor outputColor;       // "[color]"
-    };
-
-    // Shorthands.
-    enum {
-        kR = kR_GrColorComponentFlag,
-        kG = kG_GrColorComponentFlag,
-        kB = kB_GrColorComponentFlag,
-        kA = kA_GrColorComponentFlag,
-        kRGB = kRGB_GrColorComponentFlags,
-        kRGBA = kRGBA_GrColorComponentFlags
-    };
-
-    // Note: below, SkColors are non-premultiplied, where as GrColors are premultiplied.
-
-    const SkColor c1 = SkColorSetARGB(200, 200, 200, 200);
-    const SkColor c2 = SkColorSetARGB(60, 60, 60, 60);
-    const GrColor gr_c1 = SkColorToPremulGrColor(c1);
-    const GrColor gr_c2 = SkColorToPremulGrColor(c2);
-
-    const GrColor gr_black = GrColorPackA4(0);
-    const GrColor gr_white = GrColorPackA4(255);
-    const GrColor gr_whiteTrans = GrColorPackA4(128);
-
-    GetConstantComponentTestCase filterTests[] = {
-        // A color filtered with Clear produces black.
-        { kRGBA, gr_white, SK_ColorBLACK, SkBlendMode::kClear, kRGBA, gr_black },
-        { kRGBA, gr_c1,    SK_ColorWHITE, SkBlendMode::kClear, kRGBA, gr_black },
-        { kR,    gr_white, c1,            SkBlendMode::kClear, kRGBA, gr_black },
-
-        // A color filtered with a color in mode Src, produces the filter color.
-        { kRGBA, gr_c2, c1, SkBlendMode::kSrc, kRGBA, gr_c1 },
-        { kA,    gr_c1, c1, SkBlendMode::kSrc, kRGBA, gr_c1 },
-
-        // A color filtered with SrcOver produces a color.
-        { kRGBA, gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kSrcOver, kRGBA, GrColorPackRGBA(164, 164, 164, 192)},
-        // An unknown color with known alpha filtered with SrcOver produces an unknown color with known alpha.
-        { kA   , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kSrcOver, kA   , GrColorPackRGBA(0, 0, 0, 192)},
-        // A color with unknown alpha filtered with SrcOver produces a color with unknown alpha.
-        { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kSrcOver, kRGB, GrColorPackRGBA(164, 164, 164, 0)},
-
-        // A color filtered with DstOver produces a color.
-        { kRGBA, gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kDstOver, kRGBA, GrColorPackRGBA(178, 178, 178, 192)},
-        // An unknown color with known alpha filtered with DstOver produces an unknown color with known alpha.
-        { kA   , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kDstOver, kA   , GrColorPackRGBA(0, 0, 0, 192)},
-        // A color with unknown alpha filtered with DstOver produces an unknown color.
-        { kRGB , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kDstOver, 0    , gr_black},
-
-        // An unknown color with known alpha and red component filtered with Multiply produces an unknown color with known red and alpha.
-        { kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkBlendMode::kModulate, kR|kA, GrColorPackRGBA(50, 0, 0, 64) }
-    };
-
-    GrPaint paint;
-    for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) {
-        const GetConstantComponentTestCase& test = filterTests[i];
-        auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode));
-        // TODO: Test other color spaces
-        sk_sp<GrFragmentProcessor> fp(cf->asFragmentProcessor(ctxInfo.grContext(), nullptr));
-        REPORTER_ASSERT(reporter, fp);
-        GrInvariantOutput inout(test.inputColor,
-                                static_cast<GrColorComponentFlags>(test.inputComponents));
-        fp->computeInvariantOutput(&inout);
-        REPORTER_ASSERT(reporter, filterColor(inout.color(), inout.validFlags()) ==
-                                  test.outputColor);
-        REPORTER_ASSERT(reporter, test.outputComponents == inout.validFlags());
-    }
-}
-
-#endif
index aa34831..dc7db51 100644 (file)
@@ -10,7 +10,6 @@
 #if SK_SUPPORT_GPU
 
 #include "GrFragmentProcessor.h"
-#include "GrInvariantOutput.h"
 #include "GrRenderTargetContext.h"
 #include "GrTexture.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -36,10 +35,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
 
         void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
 
-        void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-            inout->setToUnknown();
-        }
-
         bool onIsEqual(const GrFragmentProcessor& that) const override { return true; }
 
         GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
index 678fbaa..a69371d 100644 (file)
@@ -64,11 +64,6 @@ public:
         b->add32(sk_atomic_inc(&gKey));
     }
 
-    void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
-        // We don't care about optimizing these processors.
-        inout->setToUnknown();
-    }
-
 private:
     TestFP(const SkTArray<sk_sp<GrTexture>>& textures, const SkTArray<sk_sp<GrBuffer>>& buffers,
            const SkTArray<Image>& images)