diff options
author | Brian Osman <brianosman@google.com> | 2017-09-20 09:53:22 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-20 14:28:03 +0000 |
commit | 9a725dd9485654155e2e4196c32d372360bcdb61 (patch) | |
tree | 7b2b226fdffc212cce21de7d7804308dc7abbf92 /src | |
parent | 906126eedc792f12935145a9a2f13eea1d1cd86d (diff) |
Use shader based blending to clamp kPlus mode w/F16
Bug: skia:6173
Change-Id: I21042d484d9a7b3eee04aa3301d9793d00ad6908
Reviewed-on: https://skia-review.googlesource.com/48183
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src')
44 files changed, 197 insertions, 116 deletions
diff --git a/src/gpu/GrProcessorSet.cpp b/src/gpu/GrProcessorSet.cpp index cb4a25f799..7694806659 100644 --- a/src/gpu/GrProcessorSet.cpp +++ b/src/gpu/GrProcessorSet.cpp @@ -159,7 +159,9 @@ bool GrProcessorSet::operator==(const GrProcessorSet& that) const { GrProcessorSet::Analysis GrProcessorSet::finalize(const GrProcessorAnalysisColor& colorInput, const GrProcessorAnalysisCoverage coverageInput, const GrAppliedClip* clip, bool isMixedSamples, - const GrCaps& caps, GrColor* overrideInputColor) { + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped, + GrColor* overrideInputColor) { SkASSERT(!this->isFinalized()); SkASSERT(!fFragmentProcessorOffset); @@ -207,7 +209,7 @@ GrProcessorSet::Analysis GrProcessorSet::finalize(const GrProcessorAnalysisColor } GrXPFactory::AnalysisProperties props = GrXPFactory::GetAnalysisProperties( - this->xpFactory(), colorAnalysis.outputColor(), outputCoverage, caps); + this->xpFactory(), colorAnalysis.outputColor(), outputCoverage, caps, dstIsClamped); if (!this->numCoverageFragmentProcessors() && GrProcessorAnalysisCoverage::kNone == coverageInput) { analysis.fCanCombineOverlappedStencilAndCover = SkToBool( @@ -241,7 +243,7 @@ GrProcessorSet::Analysis GrProcessorSet::finalize(const GrProcessorAnalysisColor fColorFragmentProcessorCnt -= colorFPsToEliminate; auto xp = GrXPFactory::MakeXferProcessor(this->xpFactory(), colorAnalysis.outputColor(), - outputCoverage, isMixedSamples, caps); + outputCoverage, isMixedSamples, caps, dstIsClamped); fXP.fProcessor = xp.release(); fFlags |= kFinalized_Flag; diff --git a/src/gpu/GrProcessorSet.h b/src/gpu/GrProcessorSet.h index 05d0a59ab2..b61980b405 100644 --- a/src/gpu/GrProcessorSet.h +++ b/src/gpu/GrProcessorSet.h @@ -141,7 +141,8 @@ public: */ Analysis finalize(const GrProcessorAnalysisColor& colorInput, const GrProcessorAnalysisCoverage coverageInput, const GrAppliedClip*, - bool isMixedSamples, const GrCaps&, GrColor* inputColorOverride); + bool isMixedSamples, const GrCaps&, GrPixelConfigIsClamped, + GrColor* inputColorOverride); bool isFinalized() const { return SkToBool(kFinalized_Flag & fFlags); } diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index cd2d099738..49e7283c65 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -1801,8 +1801,10 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr this->setNeedsStencil(); } + GrPixelConfigIsClamped dstIsClamped = GrGetPixelConfigIsClamped(this->config()); GrXferProcessor::DstProxy dstProxy; - if (op->finalize(*this->caps(), &appliedClip) == GrDrawOp::RequiresDstTexture::kYes) { + if (GrDrawOp::RequiresDstTexture::kYes == op->finalize(*this->caps(), &appliedClip, + dstIsClamped)) { if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, op->bounds(), &dstProxy)) { return SK_InvalidUniqueID; } diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp index 8c0568bcae..c7383f2947 100644 --- a/src/gpu/GrXferProcessor.cpp +++ b/src/gpu/GrXferProcessor.cpp @@ -157,12 +157,14 @@ GrXPFactory::AnalysisProperties GrXPFactory::GetAnalysisProperties( const GrXPFactory* factory, const GrProcessorAnalysisColor& color, const GrProcessorAnalysisCoverage& coverage, - const GrCaps& caps) { + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) { AnalysisProperties result; if (factory) { - result = factory->analysisProperties(color, coverage, caps); + result = factory->analysisProperties(color, coverage, caps, dstIsClamped); } else { - result = GrPorterDuffXPFactory::SrcOverAnalysisProperties(color, coverage, caps); + result = GrPorterDuffXPFactory::SrcOverAnalysisProperties(color, coverage, caps, + dstIsClamped); } SkASSERT(!(result & AnalysisProperties::kRequiresDstTexture)); if ((result & AnalysisProperties::kReadsDstInShader) && @@ -179,10 +181,11 @@ sk_sp<const GrXferProcessor> GrXPFactory::MakeXferProcessor(const GrXPFactory* f const GrProcessorAnalysisColor& color, GrProcessorAnalysisCoverage coverage, bool hasMixedSamples, - const GrCaps& caps) { + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) { SkASSERT(!hasMixedSamples || caps.shaderCaps()->dualSourceBlendingSupport()); if (factory) { - return factory->makeXferProcessor(color, coverage, hasMixedSamples, caps); + return factory->makeXferProcessor(color, coverage, hasMixedSamples, caps, dstIsClamped); } else { return GrPorterDuffXPFactory::MakeSrcOverXferProcessor(color, coverage, hasMixedSamples, caps); diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h index 6bffba2495..419c83df70 100644 --- a/src/gpu/GrXferProcessor.h +++ b/src/gpu/GrXferProcessor.h @@ -287,12 +287,14 @@ public: const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps& caps); + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped); static AnalysisProperties GetAnalysisProperties(const GrXPFactory*, const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&); + const GrCaps&, + GrPixelConfigIsClamped); protected: constexpr GrXPFactory() {} @@ -301,7 +303,8 @@ private: virtual sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps&) const = 0; + const GrCaps&, + GrPixelConfigIsClamped) const = 0; /** * Subclass analysis implementation. This should not return kNeedsDstInTexture as that will be @@ -309,7 +312,8 @@ private: */ virtual AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&) const = 0; + const GrCaps&, + GrPixelConfigIsClamped) const = 0; }; #if defined(__GNUC__) || defined(__clang) #pragma GCC diagnostic pop diff --git a/src/gpu/ccpr/GrCCPRCoverageOp.h b/src/gpu/ccpr/GrCCPRCoverageOp.h index 77013dd0f7..7d457fef33 100644 --- a/src/gpu/ccpr/GrCCPRCoverageOp.h +++ b/src/gpu/ccpr/GrCCPRCoverageOp.h @@ -124,7 +124,8 @@ public: // GrDrawOp interface. const char* name() const override { return "GrCCPRCoverageOp"; } FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; } - RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override { + RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, + GrPixelConfigIsClamped) override { return RequiresDstTexture::kNo; } bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override { return false; } diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp index 0e6198951e..9b2e956f9e 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp @@ -117,11 +117,12 @@ GrCoverageCountingPathRenderer::DrawPathsOp::DrawPathsOp(GrCoverageCountingPathR this->setBounds(devBounds, GrOp::HasAABloat::kYes, GrOp::IsZeroArea::kNo); } -GrDrawOp::RequiresDstTexture DrawPathsOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) { +GrDrawOp::RequiresDstTexture DrawPathsOp::finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) { SingleDraw& onlyDraw = this->getOnlyPathDraw(); - GrProcessorSet::Analysis analysis = fProcessors.finalize(onlyDraw.fColor, - GrProcessorAnalysisCoverage::kSingleChannel, - clip, false, caps, &onlyDraw.fColor); + GrProcessorSet::Analysis analysis = fProcessors.finalize( + onlyDraw.fColor, GrProcessorAnalysisCoverage::kSingleChannel, clip, false, caps, + dstIsClamped, &onlyDraw.fColor); return analysis.requiresDstTexture() ? RequiresDstTexture::kYes : RequiresDstTexture::kNo; } diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h index e339c6854a..ee73cb3d18 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h @@ -63,7 +63,8 @@ public: // GrDrawOp overrides. FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; } - RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override; + RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, + GrPixelConfigIsClamped) override; void wasRecorded(GrRenderTargetOpList*) override; bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override; void onPrepare(GrOpFlushState*) override {} diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp index 267f43d5e7..0e7dcf7359 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.cpp +++ b/src/gpu/effects/GrCoverageSetOpXP.cpp @@ -211,7 +211,8 @@ sk_sp<const GrXferProcessor> GrCoverageSetOpXPFactory::makeXferProcessor( const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps& caps) const { + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) const { // We don't support inverting coverage with mixed samples. We don't expect to ever want this in // the future, however we could at some point make this work using an inverted coverage // modulation table. Note that an inverted table still won't work if there are coverage procs. diff --git a/src/gpu/effects/GrCoverageSetOpXP.h b/src/gpu/effects/GrCoverageSetOpXP.h index 062d9dddd1..72d1b01280 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.h +++ b/src/gpu/effects/GrCoverageSetOpXP.h @@ -33,11 +33,13 @@ private: sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps&) const override; + const GrCaps&, + GrPixelConfigIsClamped) const override; AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&) const override { + const GrCaps&, + GrPixelConfigIsClamped) const override { return AnalysisProperties::kIgnoresInputColor; } diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 9891ee69c0..94d8ce23d9 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -215,11 +215,13 @@ private: sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps&) const override; + const GrCaps&, + GrPixelConfigIsClamped) const override; AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&) const override; + const GrCaps&, + GrPixelConfigIsClamped) const override; GR_DECLARE_XP_FACTORY_TEST @@ -236,7 +238,8 @@ sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor( const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage coverage, bool hasMixedSamples, - const GrCaps& caps) const { + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) const { SkASSERT(GrCustomXfermode::IsSupportedMode(fMode)); if (can_use_hw_blend_equation(fHWBlendEquation, coverage, caps)) { return sk_sp<GrXferProcessor>(new CustomXP(fMode, fHWBlendEquation)); @@ -246,7 +249,7 @@ sk_sp<const GrXferProcessor> CustomXPFactory::makeXferProcessor( GrXPFactory::AnalysisProperties CustomXPFactory::analysisProperties( const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage& coverage, - const GrCaps& caps) const { + const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped) const { /* The general SVG blend equation is defined in the spec as follows: diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index ab0d835cf8..a0beecdf2d 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -78,7 +78,8 @@ sk_sp<const GrXferProcessor> GrDisableColorXPFactory::makeXferProcessor( const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps& caps) const { + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) const { return sk_sp<const GrXferProcessor>(new DisableColorXP); } diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h index 5b4ebcf929..f1ac32bb4f 100644 --- a/src/gpu/effects/GrDisableColorXP.h +++ b/src/gpu/effects/GrDisableColorXP.h @@ -26,7 +26,8 @@ private: AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&) const override { + const GrCaps&, + GrPixelConfigIsClamped) const override { return AnalysisProperties::kCompatibleWithAlphaAsCoverage | AnalysisProperties::kIgnoresInputColor; } @@ -34,7 +35,8 @@ private: sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps&) const override; + const GrCaps&, + GrPixelConfigIsClamped) const override; GR_DECLARE_XP_FACTORY_TEST diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index e6c7bf9a80..4f23bdcf29 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -760,7 +760,7 @@ const GrXPFactory* GrPorterDuffXPFactory::Get(SkBlendMode blendMode) { sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor( const GrProcessorAnalysisColor& color, GrProcessorAnalysisCoverage coverage, - bool hasMixedSamples, const GrCaps& caps) const { + bool hasMixedSamples, const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped) const { BlendFormula blendFormula; bool isLCD = coverage == GrProcessorAnalysisCoverage::kLCD; if (isLCD) { @@ -779,8 +779,10 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor( hasMixedSamples, fBlendMode); } + bool needsClamp = SkBlendMode::kPlus == fBlendMode; if ((blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) || - (isLCD && (SkBlendMode::kSrcOver != fBlendMode /*|| !color.isOpaque()*/))) { + (isLCD && (SkBlendMode::kSrcOver != fBlendMode /*|| !color.isOpaque()*/)) || + (needsClamp && (GrPixelConfigIsClamped::kNo == dstIsClamped))) { return sk_sp<const GrXferProcessor>(new ShaderPDXferProcessor(hasMixedSamples, fBlendMode, coverage)); } @@ -789,7 +791,7 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::makeXferProcessor( static inline GrXPFactory::AnalysisProperties analysis_properties( const GrProcessorAnalysisColor& color, const GrProcessorAnalysisCoverage& coverage, - const GrCaps& caps, SkBlendMode mode) { + const GrCaps& caps, GrPixelConfigIsClamped dstIsClamped, SkBlendMode mode) { using AnalysisProperties = GrXPFactory::AnalysisProperties; AnalysisProperties props = AnalysisProperties::kNone; bool hasCoverage = GrProcessorAnalysisCoverage::kNone != coverage; @@ -836,6 +838,11 @@ static inline GrXPFactory::AnalysisProperties analysis_properties( } } + bool needsClamp = SkBlendMode::kPlus == mode; + if (needsClamp && (GrPixelConfigIsClamped::kNo == dstIsClamped)) { + props |= AnalysisProperties::kReadsDstInShader; + } + if (!formula.modifiesDst() || !formula.usesInputColor()) { props |= AnalysisProperties::kIgnoresInputColor; } @@ -851,8 +858,9 @@ static inline GrXPFactory::AnalysisProperties analysis_properties( GrXPFactory::AnalysisProperties GrPorterDuffXPFactory::analysisProperties( const GrProcessorAnalysisColor& color, const GrProcessorAnalysisCoverage& coverage, - const GrCaps& caps) const { - return analysis_properties(color, coverage, caps, fBlendMode); + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) const { + return analysis_properties(color, coverage, caps, dstIsClamped, fBlendMode); } GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); @@ -939,6 +947,7 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::MakeNoCoverageXP(SkBlendMode GrXPFactory::AnalysisProperties GrPorterDuffXPFactory::SrcOverAnalysisProperties( const GrProcessorAnalysisColor& color, const GrProcessorAnalysisCoverage& coverage, - const GrCaps& caps) { - return analysis_properties(color, coverage, caps, SkBlendMode::kSrcOver); + const GrCaps& caps, + GrPixelConfigIsClamped dstIsClamped) { + return analysis_properties(color, coverage, caps, dstIsClamped, SkBlendMode::kSrcOver); } diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.h b/src/gpu/effects/GrPorterDuffXferProcessor.h index 3599aeff0b..37cd6899da 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.h +++ b/src/gpu/effects/GrPorterDuffXferProcessor.h @@ -37,7 +37,8 @@ public: static AnalysisProperties SrcOverAnalysisProperties(const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&); + const GrCaps&, + GrPixelConfigIsClamped); private: constexpr GrPorterDuffXPFactory(SkBlendMode); @@ -45,11 +46,13 @@ private: sk_sp<const GrXferProcessor> makeXferProcessor(const GrProcessorAnalysisColor&, GrProcessorAnalysisCoverage, bool hasMixedSamples, - const GrCaps&) const override; + const GrCaps&, + GrPixelConfigIsClamped) const override; AnalysisProperties analysisProperties(const GrProcessorAnalysisColor&, const GrProcessorAnalysisCoverage&, - const GrCaps&) const override; + const GrCaps&, + GrPixelConfigIsClamped) const override; GR_DECLARE_XP_FACTORY_TEST static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, int* outSecondary); diff --git a/src/gpu/instanced/InstancedOp.cpp b/src/gpu/instanced/InstancedOp.cpp index 7d50e9654e..ad76c18814 100644 --- a/src/gpu/instanced/InstancedOp.cpp +++ b/src/gpu/instanced/InstancedOp.cpp @@ -120,7 +120,8 @@ void InstancedOp::appendParamsTexel(SkScalar x, SkScalar y, SkScalar z) { fInfo.fHasParams = true; } -GrDrawOp::RequiresDstTexture InstancedOp::finalize(const GrCaps& caps, const GrAppliedClip* clip) { +GrDrawOp::RequiresDstTexture InstancedOp::finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) { GrProcessorAnalysisCoverage coverageInput; bool isMixedSamples = false; if (GrAAType::kCoverage == fInfo.aaType() || @@ -132,7 +133,8 @@ GrDrawOp::RequiresDstTexture InstancedOp::finalize(const GrCaps& caps, const GrA } GrProcessorSet::Analysis analysis = fProcessors.finalize(this->getSingleInstance().fColor, coverageInput, clip, - isMixedSamples, caps, &this->getSingleDraw().fInstance.fColor); + isMixedSamples, caps, dstIsClamped, + &this->getSingleDraw().fInstance.fColor); Draw& draw = this->getSingleDraw(); // This will assert if we have > 1 command. SkASSERT(draw.fGeometry.isEmpty()); diff --git a/src/gpu/instanced/InstancedOp.h b/src/gpu/instanced/InstancedOp.h index d0eb095d6f..eb2a6fa437 100644 --- a/src/gpu/instanced/InstancedOp.h +++ b/src/gpu/instanced/InstancedOp.h @@ -68,7 +68,8 @@ public: return GrAATypeIsHW(fInfo.aaType()) ? FixedFunctionFlags::kUsesHWAA : FixedFunctionFlags::kNone; } - RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override; + RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, + GrPixelConfigIsClamped) override; // Registers the op with the InstancedRendering list of tracked ops. void wasRecorded(GrRenderTargetOpList*) override; diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp index 50077a89b6..03dabe3b83 100644 --- a/src/gpu/ops/GrAAConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp @@ -765,8 +765,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, &fPaths.back().fColor); } diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp index 4c91d7cccd..48f9f3bc58 100644 --- a/src/gpu/ops/GrAAFillRectOp.cpp +++ b/src/gpu/ops/GrAAFillRectOp.cpp @@ -223,10 +223,11 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor color = this->first()->color(); auto result = fHelper.xpRequiresDstTexture( - caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, &color); + caps, clip, dstIsClamped, GrProcessorAnalysisCoverage::kSingleChannel, &color); this->first()->setColor(color); return result; } diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp index 8881e4cf55..a107528bdf 100644 --- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp @@ -800,9 +800,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, - &fColor); + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, &fColor); } private: diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp index 5d6b6cf9dd..cd87e286b5 100644 --- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp @@ -196,8 +196,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, &fPaths.back().fColor); } diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp index 22cd6ced19..d4f9bdea41 100644 --- a/src/gpu/ops/GrAAStrokeRectOp.cpp +++ b/src/gpu/ops/GrAAStrokeRectOp.cpp @@ -195,8 +195,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, &fRects.back().fColor); } diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp index 65b3c373f9..1166fd83e3 100644 --- a/src/gpu/ops/GrAtlasTextOp.cpp +++ b/src/gpu/ops/GrAtlasTextOp.cpp @@ -44,7 +44,8 @@ GrDrawOp::FixedFunctionFlags GrAtlasTextOp::fixedFunctionFlags() const { } GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps, - const GrAppliedClip* clip) { + const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) { GrProcessorAnalysisCoverage coverage; GrProcessorAnalysisColor color; if (kColorBitmapMask_MaskType == fMaskType) { @@ -67,7 +68,7 @@ GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps, coverage = GrProcessorAnalysisCoverage::kNone; break; } - auto analysis = fProcessors.finalize(color, coverage, clip, false, caps, &fColor); + auto analysis = fProcessors.finalize(color, coverage, clip, false, caps, dstIsClamped, &fColor); fUsesLocalCoords = analysis.usesLocalCoords(); fCanCombineOnTouchOrOverlap = !analysis.requiresDstTexture() && diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h index 0a1a7a1ae9..7ae31665f4 100644 --- a/src/gpu/ops/GrAtlasTextOp.h +++ b/src/gpu/ops/GrAtlasTextOp.h @@ -112,7 +112,8 @@ public: FixedFunctionFlags fixedFunctionFlags() const override; - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override; + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override; private: GrAtlasTextOp(GrPaint&& paint) diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp index 76f1ff4981..5f886cdcf1 100644 --- a/src/gpu/ops/GrDashOp.cpp +++ b/src/gpu/ops/GrDashOp.cpp @@ -296,14 +296,16 @@ public: return flags; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrProcessorAnalysisCoverage coverage; if (AAMode::kNone == fAAMode && !clip->clipCoverageFragmentProcessor()) { coverage = GrProcessorAnalysisCoverage::kNone; } else { coverage = GrProcessorAnalysisCoverage::kSingleChannel; } - auto analysis = fProcessorSet.finalize(fColor, coverage, clip, false, caps, &fColor); + auto analysis = fProcessorSet.finalize(fColor, coverage, clip, false, caps, dstIsClamped, + &fColor); fDisallowCombineOnTouchOrOverlap = analysis.requiresDstTexture() || (fProcessorSet.xferProcessor() && fProcessorSet.xferProcessor()->xferBarrierType(caps)); diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp index 420be4be3f..40631a74ff 100644 --- a/src/gpu/ops/GrDefaultPathRenderer.cpp +++ b/src/gpu/ops/GrDefaultPathRenderer.cpp @@ -376,11 +376,12 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrProcessorAnalysisCoverage gpCoverage = this->coverage() == 0xFF ? GrProcessorAnalysisCoverage::kNone : GrProcessorAnalysisCoverage::kSingleChannel; - return fHelper.xpRequiresDstTexture(caps, clip, gpCoverage, &fColor); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, gpCoverage, &fColor); } private: diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp index 47ebbd5607..bd5ffbb4f9 100644 --- a/src/gpu/ops/GrDrawAtlasOp.cpp +++ b/src/gpu/ops/GrDrawAtlasOp.cpp @@ -177,15 +177,16 @@ GrDrawOp::FixedFunctionFlags GrDrawAtlasOp::fixedFunctionFlags() const { } GrDrawOp::RequiresDstTexture GrDrawAtlasOp::finalize(const GrCaps& caps, - const GrAppliedClip* clip) { + const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) { GrProcessorAnalysisColor gpColor; if (this->hasColors()) { gpColor.setToUnknown(); } else { gpColor.setToConstant(fColor); } - auto result = - fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, &gpColor); + auto result = fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, &gpColor); if (gpColor.isConstant(&fColor)) { fHasColors = false; } diff --git a/src/gpu/ops/GrDrawAtlasOp.h b/src/gpu/ops/GrDrawAtlasOp.h index 8530e5b3dc..55c2aee3a2 100644 --- a/src/gpu/ops/GrDrawAtlasOp.h +++ b/src/gpu/ops/GrDrawAtlasOp.h @@ -41,7 +41,8 @@ public: FixedFunctionFlags fixedFunctionFlags() const override; - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override; + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override; private: void onPrepareDraws(Target*) override; diff --git a/src/gpu/ops/GrDrawOp.h b/src/gpu/ops/GrDrawOp.h index 54b9f1674b..145d2e2981 100644 --- a/src/gpu/ops/GrDrawOp.h +++ b/src/gpu/ops/GrDrawOp.h @@ -80,7 +80,8 @@ public: * at this time the op must report whether a copy of the destination (or destination texture * itself) needs to be provided to the GrXferProcessor when this op executes. */ - virtual RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) = 0; + virtual RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, + GrPixelConfigIsClamped) = 0; protected: struct QueuedUpload { diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h index 114ce96a64..7b1072eea4 100644 --- a/src/gpu/ops/GrDrawPathOp.h +++ b/src/gpu/ops/GrDrawPathOp.h @@ -31,9 +31,10 @@ protected: } return FixedFunctionFlags::kUsesStencil; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return this->doProcessorAnalysis(caps, clip).requiresDstTexture() ? RequiresDstTexture::kYes - : RequiresDstTexture::kNo; + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return this->doProcessorAnalysis(caps, clip, dstIsClamped).requiresDstTexture() + ? RequiresDstTexture::kYes : RequiresDstTexture::kNo; } void visitProxies(const VisitProxyFunc& func) const override { @@ -49,10 +50,11 @@ protected: uint32_t pipelineSRGBFlags() const { return fPipelineSRGBFlags; } inline GrPipeline::InitArgs pipelineInitArgs(const GrOpFlushState&); const GrProcessorSet::Analysis& doProcessorAnalysis(const GrCaps& caps, - const GrAppliedClip* clip) { + const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) { bool isMixedSamples = GrAAType::kMixedSamples == fAAType; fAnalysis = fProcessorSet.finalize(fInputColor, GrProcessorAnalysisCoverage::kNone, clip, - isMixedSamples, caps, &fInputColor); + isMixedSamples, caps, dstIsClamped, &fInputColor); return fAnalysis; } const GrProcessorSet::Analysis& processorAnalysis() const { diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp index 17a4f74e4e..61696f5ea4 100644 --- a/src/gpu/ops/GrDrawVerticesOp.cpp +++ b/src/gpu/ops/GrDrawVerticesOp.cpp @@ -82,15 +82,16 @@ GrDrawOp::FixedFunctionFlags GrDrawVerticesOp::fixedFunctionFlags() const { } GrDrawOp::RequiresDstTexture GrDrawVerticesOp::finalize(const GrCaps& caps, - const GrAppliedClip* clip) { + const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) { GrProcessorAnalysisColor gpColor; if (this->requiresPerVertexColors()) { gpColor.setToUnknown(); } else { gpColor.setToConstant(fMeshes.front().fColor); } - auto result = - fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, &gpColor); + auto result = fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, &gpColor); if (gpColor.isConstant(&fMeshes.front().fColor)) { fMeshes.front().fIgnoreColors = true; fFlags &= ~kRequiresPerVertexColors_Flag; diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h index 6e78008138..cbbc16e286 100644 --- a/src/gpu/ops/GrDrawVerticesOp.h +++ b/src/gpu/ops/GrDrawVerticesOp.h @@ -54,7 +54,8 @@ public: FixedFunctionFlags fixedFunctionFlags() const override; - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override; + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override; private: enum class ColorArrayType { diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp index 35d1ab7fcb..a5473ceab7 100644 --- a/src/gpu/ops/GrLatticeOp.cpp +++ b/src/gpu/ops/GrLatticeOp.cpp @@ -80,8 +80,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, &fPatches.front().fColor); } diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp index 45fe9f3009..21e2af8e95 100644 --- a/src/gpu/ops/GrMSAAPathRenderer.cpp +++ b/src/gpu/ops/GrMSAAPathRenderer.cpp @@ -275,8 +275,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, &fPaths.front().fColor); } diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp index 02a5e84378..6eaef696cb 100644 --- a/src/gpu/ops/GrNonAAFillRectOp.cpp +++ b/src/gpu/ops/GrNonAAFillRectOp.cpp @@ -158,9 +158,11 @@ public: return str; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fRects.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } @@ -280,9 +282,11 @@ public: return str; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fRects.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp index 1dd1733e07..6e53bea93c 100644 --- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp +++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp @@ -129,9 +129,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, - &fColor); + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, &fColor); } private: diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp index 5580e52475..5b30c4a191 100644 --- a/src/gpu/ops/GrOvalOpFactory.cpp +++ b/src/gpu/ops/GrOvalOpFactory.cpp @@ -804,10 +804,11 @@ public: return string; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fCircles.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, - color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } @@ -1272,10 +1273,11 @@ public: return string; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fEllipses.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, - color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } @@ -1502,10 +1504,11 @@ public: return string; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fEllipses.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, - color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } @@ -1819,10 +1822,11 @@ public: return string; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fRRects.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, - color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } @@ -2177,10 +2181,11 @@ public: return string; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrColor* color = &fRRects.front().fColor; - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, - color); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, color); } FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp index 23a5020f6b..177a18577a 100644 --- a/src/gpu/ops/GrRegionOp.cpp +++ b/src/gpu/ops/GrRegionOp.cpp @@ -98,9 +98,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kNone, - &fRegions[0].fColor); + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kNone, &fRegions[0].fColor); } private: diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp index b22dd06df1..24bbff48ef 100644 --- a/src/gpu/ops/GrShadowRRectOp.cpp +++ b/src/gpu/ops/GrShadowRRectOp.cpp @@ -254,7 +254,8 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; } - RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*) override { + RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*, + GrPixelConfigIsClamped) override { return RequiresDstTexture::kNo; } diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp b/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp index 7c8ca2e5de..b32344af11 100644 --- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp +++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp @@ -64,8 +64,8 @@ bool GrSimpleMeshDrawOpHelper::isCompatible(const GrSimpleMeshDrawOpHelper& that } GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture( - const GrCaps& caps, const GrAppliedClip* clip, GrProcessorAnalysisCoverage geometryCoverage, - GrProcessorAnalysisColor* geometryColor) { + const GrCaps& caps, const GrAppliedClip* clip, GrPixelConfigIsClamped dstIsClamped, + GrProcessorAnalysisCoverage geometryCoverage, GrProcessorAnalysisColor* geometryColor) { SkDEBUGCODE(fDidAnalysis = true); GrProcessorSet::Analysis analysis; if (fProcessors) { @@ -78,7 +78,7 @@ GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture( bool isMixedSamples = this->aaType() == GrAAType::kMixedSamples; GrColor overrideColor; analysis = fProcessors->finalize(*geometryColor, coverage, clip, isMixedSamples, caps, - &overrideColor); + dstIsClamped, &overrideColor); if (analysis.inputColorIsOverridden()) { *geometryColor = overrideColor; } @@ -93,10 +93,10 @@ GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture( } GrDrawOp::RequiresDstTexture GrSimpleMeshDrawOpHelper::xpRequiresDstTexture( - const GrCaps& caps, const GrAppliedClip* clip, GrProcessorAnalysisCoverage geometryCoverage, - GrColor* geometryColor) { + const GrCaps& caps, const GrAppliedClip* clip, GrPixelConfigIsClamped dstIsClamped, + GrProcessorAnalysisCoverage geometryCoverage, GrColor* geometryColor) { GrProcessorAnalysisColor color = *geometryColor; - auto result = this->xpRequiresDstTexture(caps, clip, geometryCoverage, &color); + auto result = this->xpRequiresDstTexture(caps, clip, dstIsClamped, geometryCoverage, &color); color.isConstant(geometryColor); return result; } diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h index 47a81827c6..020f25fce6 100644 --- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h +++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h @@ -63,6 +63,7 @@ public: * color from its geometry processor instead. */ GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped, GrProcessorAnalysisCoverage geometryCoverage, GrProcessorAnalysisColor* geometryColor); @@ -72,6 +73,7 @@ public: * changed the op must override its geometry processor color output with the new color. */ GrDrawOp::RequiresDstTexture xpRequiresDstTexture(const GrCaps&, const GrAppliedClip*, + GrPixelConfigIsClamped dstIsClamped, GrProcessorAnalysisCoverage geometryCoverage, GrColor* geometryColor); diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp index f17c7e0dcb..fd868a1dfe 100644 --- a/src/gpu/ops/GrSmallPathRenderer.cpp +++ b/src/gpu/ops/GrSmallPathRenderer.cpp @@ -215,8 +215,10 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { - return fHelper.xpRequiresDstTexture(caps, clip, GrProcessorAnalysisCoverage::kSingleChannel, + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, + GrProcessorAnalysisCoverage::kSingleChannel, &fShapes.front().fColor); } diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp index 730e91be1f..099cb1151f 100644 --- a/src/gpu/ops/GrTessellatingPathRenderer.cpp +++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp @@ -215,11 +215,12 @@ public: FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { GrProcessorAnalysisCoverage coverage = fAntiAlias ? GrProcessorAnalysisCoverage::kSingleChannel : GrProcessorAnalysisCoverage::kNone; - return fHelper.xpRequiresDstTexture(caps, clip, coverage, &fColor); + return fHelper.xpRequiresDstTexture(caps, clip, dstIsClamped, coverage, &fColor); } private: diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp index 732b9c9e84..5dc30f31d2 100644 --- a/src/gpu/ops/GrTextureOp.cpp +++ b/src/gpu/ops/GrTextureOp.cpp @@ -276,7 +276,8 @@ public: return str; } - RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override { + RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip, + GrPixelConfigIsClamped dstIsClamped) override { SkASSERT(!fFinalized); SkASSERT(1 == fProxyCnt); fFinalized = true; |