aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2016-01-22 06:48:46 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-22 06:48:46 -0800
commit7df3f5e127f8016d17b637cc48a6a4718f1a6822 (patch)
tree224a919d0ed775835fb6dd40ddb2399214de081e /src/gpu/effects
parent7481e75830dfae1e9084ff62e3d8438879e31aaa (diff)
added support for PLS path rendering
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp5
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp19
-rw-r--r--src/gpu/effects/GrDisableColorXP.cpp2
-rw-r--r--src/gpu/effects/GrDisableColorXP.h6
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp12
5 files changed, 29 insertions, 15 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/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 &&