diff options
author | ethannicholas <ethannicholas@google.com> | 2016-01-30 09:59:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-30 09:59:10 -0800 |
commit | 2279325d539700ee3da29d6e874b3b3ce1dcf49c (patch) | |
tree | fa68207d94b4919c1759578a5d5192786d83c6d6 /src/gpu/effects | |
parent | ad38ed6003ad89a21e40d76987db4bba7d42f3d0 (diff) |
added support for PLS path rendering
BUG=skia:3555
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1541903002
Committed: https://skia.googlesource.com/skia/+/7df3f5e127f8016d17b637cc48a6a4718f1a6822
Review URL: https://codereview.chromium.org/1541903002
Diffstat (limited to 'src/gpu/effects')
-rw-r--r-- | src/gpu/effects/GrCoverageSetOpXP.cpp | 5 | ||||
-rw-r--r-- | src/gpu/effects/GrCustomXfermode.cpp | 19 | ||||
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 1 | ||||
-rw-r--r-- | src/gpu/effects/GrDisableColorXP.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrDisableColorXP.h | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrPorterDuffXferProcessor.cpp | 12 |
6 files changed, 29 insertions, 16 deletions
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp index 7761a6445a..8c98c6c843 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.cpp +++ b/src/gpu/effects/GrCoverageSetOpXP.cpp @@ -9,6 +9,7 @@ #include "effects/GrCoverageSetOpXP.h" #include "GrCaps.h" #include "GrColor.h" +#include "GrPipeline.h" #include "GrProcessor.h" #include "GrProcOptInfo.h" #include "glsl/GrGLSLBlend.h" @@ -151,7 +152,6 @@ class ShaderCSOXferProcessor : public GrXferProcessor { public: ShaderCSOXferProcessor(const DstTexture* dstTexture, bool hasMixedSamples, - SkXfermode::Mode xfermode, SkRegion::Op regionOp, bool invertCoverage) : INHERITED(dstTexture, true, hasMixedSamples) @@ -323,6 +323,9 @@ GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps, return nullptr; } + if (optimizations.fOverrides.fUsePLSDstRead) { + return new ShaderCSOXferProcessor(dst, hasMixedSamples, fRegionOp, fInvertCoverage); + } return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage); } diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 459ff52948..dccec0c599 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -54,12 +54,15 @@ static GrBlendEquation hw_blend_equation(SkXfermode::Mode mode) { } static bool can_use_hw_blend_equation(GrBlendEquation equation, - const GrProcOptInfo& coveragePOI, + const GrPipelineOptimizations& opt, const GrCaps& caps) { if (!caps.advancedBlendEquationSupport()) { return false; } - if (coveragePOI.isFourChannelOutput()) { + if (opt.fOverrides.fUsePLSDstRead) { + return false; + } + if (opt.fCoveragePOI.isFourChannelOutput()) { return false; // LCD coverage must be applied after the blend equation. } if (caps.canUseAdvancedBlendEquation(equation)) { @@ -334,7 +337,7 @@ private: bool hasMixedSamples, const DstTexture*) const override; - bool willReadDstColor(const GrCaps& caps, + bool onWillReadDstColor(const GrCaps& caps, const GrPipelineOptimizations& optimizations, bool hasMixedSamples) const override; @@ -362,17 +365,17 @@ GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps, const GrPipelineOptimizations& opt, bool hasMixedSamples, const DstTexture* dstTexture) const { - if (can_use_hw_blend_equation(fHWBlendEquation, opt.fCoveragePOI, caps)) { + if (can_use_hw_blend_equation(fHWBlendEquation, opt, caps)) { SkASSERT(!dstTexture || !dstTexture->texture()); return new CustomXP(fMode, fHWBlendEquation); } return new CustomXP(dstTexture, hasMixedSamples, fMode); } -bool CustomXPFactory::willReadDstColor(const GrCaps& caps, - const GrPipelineOptimizations& optimizations, - bool hasMixedSamples) const { - return !can_use_hw_blend_equation(fHWBlendEquation, optimizations.fCoveragePOI, caps); +bool CustomXPFactory::onWillReadDstColor(const GrCaps& caps, + const GrPipelineOptimizations& optimizations, + bool hasMixedSamples) const { + return !can_use_hw_blend_equation(fHWBlendEquation, optimizations, caps); } void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 1516efd2b2..09dc90a529 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -275,7 +275,6 @@ public: // When this is called on a batch, there is only one geometry bundle color->setKnownFourComponents(fGeoData[0].fColor); coverage->setUnknownSingleComponent(); - overrides->fUsePLSDstRead = false; } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index 70e40e4a14..937bea8c35 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -6,6 +6,7 @@ */ #include "effects/GrDisableColorXP.h" +#include "GrPipeline.h" #include "GrProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -97,6 +98,7 @@ GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, const GrPipelineOptimizations& optimizations, bool hasMixedSamples, const DstTexture* dst) const { + SkASSERT(!optimizations.fOverrides.fUsePLSDstRead); return DisableColorXP::Create(); } diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h index 94aae31751..21e69327f6 100644 --- a/src/gpu/effects/GrDisableColorXP.h +++ b/src/gpu/effects/GrDisableColorXP.h @@ -31,9 +31,9 @@ private: bool hasMixedSamples, const DstTexture* dstTexture) const override; - bool willReadDstColor(const GrCaps& caps, - const GrPipelineOptimizations& optimizations, - bool hasMixedSamples) const override { + bool onWillReadDstColor(const GrCaps& caps, + const GrPipelineOptimizations& optimizations, + bool hasMixedSamples) const override { return false; } diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index c443e1e992..d1059c7c7b 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -739,6 +739,9 @@ GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps, const GrPipelineOptimizations& optimizations, bool hasMixedSamples, const DstTexture* dstTexture) const { + if (optimizations.fOverrides.fUsePLSDstRead) { + return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, fXfermode); + } BlendFormula blendFormula; if (optimizations.fCoveragePOI.isFourChannelOutput()) { if (SkXfermode::kSrcOver_Mode == fXfermode && @@ -795,9 +798,9 @@ void GrPorterDuffXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorP } } -bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps, - const GrPipelineOptimizations& optimizations, - bool hasMixedSamples) const { +bool GrPorterDuffXPFactory::onWillReadDstColor(const GrCaps& caps, + const GrPipelineOptimizations& optimizations, + bool hasMixedSamples) const { if (caps.shaderCaps()->dualSourceBlendingSupport()) { return false; } @@ -854,6 +857,9 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor( const GrPipelineOptimizations& optimizations, bool hasMixedSamples, const GrXferProcessor::DstTexture* dstTexture) { + if (optimizations.fOverrides.fUsePLSDstRead) { + return new ShaderPDXferProcessor(dstTexture, hasMixedSamples, SkXfermode::kSrcOver_Mode); + } if (!optimizations.fCoveragePOI.isFourChannelOutput() && !(optimizations.fCoveragePOI.isSolidWhite() && !hasMixedSamples && |