diff options
Diffstat (limited to 'src/gpu')
38 files changed, 53 insertions, 268 deletions
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp index f371e24b1f..90d32394e7 100644 --- a/src/gpu/GrDefaultGeoProcFactory.cpp +++ b/src/gpu/GrDefaultGeoProcFactory.cpp @@ -7,7 +7,6 @@ #include "GrDefaultGeoProcFactory.h" -#include "GrInvariantOutput.h" #include "SkRefCnt.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLGeometryProcessor.h" diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp index 07bbe7bd1b..9ff426fa2f 100644 --- a/src/gpu/GrFragmentProcessor.cpp +++ b/src/gpu/GrFragmentProcessor.cpp @@ -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 index 0000000000..43d88d0288 --- /dev/null +++ b/src/gpu/GrPipelineInput.h @@ -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 diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h index f1af14de4e..9f726d242b 100644 --- a/src/gpu/GrPrimitiveProcessor.h +++ b/src/gpu/GrPrimitiveProcessor.h @@ -21,10 +21,10 @@ * 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. diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h index be46712fa3..89b4d2ca6c 100644 --- a/src/gpu/GrProcOptInfo.h +++ b/src/gpu/GrProcOptInfo.h @@ -9,7 +9,7 @@ #define GrProcOptInfo_DEFINED #include "GrColor.h" -#include "GrInvariantOutput.h" +#include "GrPipelineInput.h" class GrDrawOp; class GrFragmentProcessor; diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 897a755902..663527e3e5 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -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" diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h index 824883c9e6..f90855195d 100644 --- a/src/gpu/effects/GrBezierEffect.h +++ b/src/gpu/effects/GrBezierEffect.h @@ -11,7 +11,6 @@ #include "GrCaps.h" #include "GrProcessor.h" #include "GrGeometryProcessor.h" -#include "GrInvariantOutput.h" #include "GrTypesPriv.h" /** diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index 2499c20cb2..5f06fc166a 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -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 diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index a51aad8cab..ba80ec2fc4 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -99,8 +99,6 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - void onComputeInvariantOutput(GrInvariantOutput* inout) const override; - GrTextureDomain fDomain; GR_DECLARE_FRAGMENT_PROCESSOR_TEST; diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 60df6b90b2..cb9cfdcc84 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -6,7 +6,6 @@ */ #include "GrBitmapTextGeoProc.h" -#include "GrInvariantOutput.h" #include "GrTexture.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLGeometryProcessor.h" diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp index a4db68df05..2d49883066 100644 --- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp +++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp @@ -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(); -} - diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 771eba80f7..ba089fab2e 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -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); diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index 151365b9b0..afa24c017c 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -64,8 +64,6 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - void onComputeInvariantOutput(GrInvariantOutput* inout) const override; - GrSwizzle fSwizzle; PMConversion fPMConversion; diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp index 1d20512a63..1013ff318a 100644 --- a/src/gpu/effects/GrConstColorProcessor.cpp +++ b/src/gpu/effects/GrConstColorProcessor.cpp @@ -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: diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index db8c2d999e..907a9e5112 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -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); diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h index 2d9d20fc7f..b5ae724d3f 100644 --- a/src/gpu/effects/GrConvexPolyEffect.h +++ b/src/gpu/effects/GrConvexPolyEffect.h @@ -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]; diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index e40d184577..4a4cb60b4e 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -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" diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index 0f9625e8a0..9a7e787577 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -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" diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 34a15651d2..036d42c4cf 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -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); diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h index 0bb9c5e1df..6d6e5b0ebd 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h @@ -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 diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h index 0bb7c5043a..581323b3cc 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.h +++ b/src/gpu/effects/GrMatrixConvolutionEffect.h @@ -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]; diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index b64ac56859..36db836653 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -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) diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index dabf11ae8d..29d3d3de0d 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -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>(); diff --git a/src/gpu/effects/GrSRGBEffect.cpp b/src/gpu/effects/GrSRGBEffect.cpp index ad90e70936..39d6403af4 100644 --- a/src/gpu/effects/GrSRGBEffect.cpp +++ b/src/gpu/effects/GrSRGBEffect.cpp @@ -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); } diff --git a/src/gpu/effects/GrSRGBEffect.h b/src/gpu/effects/GrSRGBEffect.h index 3d05dd646b..17afa5e5bd 100644 --- a/src/gpu/effects/GrSRGBEffect.h +++ b/src/gpu/effects/GrSRGBEffect.h @@ -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; diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 8b63fec907..bd4e7206f8 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -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); diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index 64ca3cb8f5..e7fe8bd4e9 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -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; diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h index 29105b5cda..894334b751 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -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. diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 58707f5744..142cd1d98b 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -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); diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index fbc20f1947..f00d4608ff 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -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; diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp index 78918ce201..612ebeab69 100644 --- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp +++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp @@ -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()); diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp index 6d917f36d5..e09e185b55 100644 --- a/src/gpu/effects/GrYUVEffect.cpp +++ b/src/gpu/effects/GrYUVEffect.cpp @@ -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; diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp index 767b7a01f9..d2397329ea 100644 --- a/src/gpu/ops/GrAAConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp @@ -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" diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp index fdb5d7f7d7..0cf08d78ad 100644 --- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp @@ -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" diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp index df62e05b30..23a024bb9f 100644 --- a/src/gpu/ops/GrAnalyticRectOp.cpp +++ b/src/gpu/ops/GrAnalyticRectOp.cpp @@ -9,7 +9,6 @@ #include "GrDrawOpTest.h" #include "GrGeometryProcessor.h" -#include "GrInvariantOutput.h" #include "GrOpFlushState.h" #include "GrProcessor.h" #include "GrResourceProvider.h" diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp index 7d7dbf1564..dbd319abcb 100644 --- a/src/gpu/ops/GrDashOp.cpp +++ b/src/gpu/ops/GrDashOp.cpp @@ -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" diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp index 4c00189a3b..a8f0c92792 100644 --- a/src/gpu/ops/GrOvalOpFactory.cpp +++ b/src/gpu/ops/GrOvalOpFactory.cpp @@ -9,7 +9,6 @@ #include "GrDrawOpTest.h" #include "GrGeometryProcessor.h" -#include "GrInvariantOutput.h" #include "GrOpFlushState.h" #include "GrProcessor.h" #include "GrResourceProvider.h" diff --git a/src/gpu/ops/GrPLSPathRenderer.cpp b/src/gpu/ops/GrPLSPathRenderer.cpp index 80a4cda688..3df31fb28d 100644 --- a/src/gpu/ops/GrPLSPathRenderer.cpp +++ b/src/gpu/ops/GrPLSPathRenderer.cpp @@ -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" |