aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2015-11-30 08:57:38 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-30 08:57:38 -0800
commitde4166a3b45d859512e27e3257841f064d67549c (patch)
tree48374959d7c5f699e4ad375ec2c0445e5e608409 /src
parente066df9673063871c478f84dd26bc3d7352819d9 (diff)
APIs which took colorPOI / coveragePOI pairs updated to take a GrPipelineOptimizations struct
TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/1480353002
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkArithmeticMode_gpu.cpp16
-rw-r--r--src/effects/SkArithmeticMode_gpu.h6
-rw-r--r--src/gpu/GrDrawTarget.cpp8
-rw-r--r--src/gpu/GrDrawTarget.h3
-rw-r--r--src/gpu/GrPipeline.cpp9
-rw-r--r--src/gpu/GrPipelineBuilder.cpp7
-rw-r--r--src/gpu/GrPipelineBuilder.h4
-rw-r--r--src/gpu/GrXferProcessor.cpp28
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp9
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp27
-rw-r--r--src/gpu/effects/GrDisableColorXP.cpp6
-rw-r--r--src/gpu/effects/GrDisableColorXP.h6
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp76
13 files changed, 88 insertions, 117 deletions
diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp
index 4d74082fb3..c9493d7e92 100644
--- a/src/effects/SkArithmeticMode_gpu.cpp
+++ b/src/effects/SkArithmeticMode_gpu.cpp
@@ -167,8 +167,7 @@ public:
bool enforcePMColor() const { return fEnforcePMColor; }
private:
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) override;
@@ -257,11 +256,11 @@ void ArithmeticXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB
GrGLSLXferProcessor* ArithmeticXP::createGLSLInstance() const { return new GLArithmeticXP(*this); }
-GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- bool doesStencilWrite,
- GrColor* overrideColor,
- const GrCaps& caps) {
+GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(
+ const GrPipelineOptimizations& optimizations,
+ bool doesStencilWrite,
+ GrColor* overrideColor,
+ const GrCaps& caps) {
return GrXferProcessor::kNone_OptFlags;
}
@@ -275,8 +274,7 @@ GrArithmeticXPFactory::GrArithmeticXPFactory(float k1, float k2, float k3, float
GrXferProcessor*
GrArithmeticXPFactory::onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture* dstTexture) const {
return new ArithmeticXP(dstTexture, hasMixedSamples, fK1, fK2, fK3, fK4, fEnforcePMColor);
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index b24d23a6e6..d6b1f881df 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -88,14 +88,12 @@ private:
GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePMColor);
GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture*) const override;
bool willReadDstColor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) const override {
return true;
}
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 7497702beb..f34e6fc956 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -113,14 +113,13 @@ void GrDrawTarget::dump() const {
#endif
bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
GrXferProcessor::DstTexture* dstTexture,
const SkRect& batchBounds) {
SkRect bounds = batchBounds;
bounds.outset(0.5f, 0.5f);
- if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), colorPOI, coveragePOI)) {
+ if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), optimizations)) {
return true;
}
@@ -545,8 +544,7 @@ bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB
args.fOpts.fCoveragePOI.completeCalculations(
pipelineBuilder->fCoverageFragmentProcessors.begin(),
pipelineBuilder->numCoverageFragmentProcessors());
- if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts.fColorPOI,
- args.fOpts.fCoveragePOI, &args.fDstTexture,
+ if (!this->setupDstReadIfNecessary(*pipelineBuilder, args.fOpts, &args.fDstTexture,
batch->bounds())) {
return false;
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 591bbc7361..240731e81b 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -279,8 +279,7 @@ private:
// but couldn't be made. Otherwise, returns true. This method needs to be protected because it
// needs to be accessed by GLPrograms to setup a correct drawstate
bool setupDstReadIfNecessary(const GrPipelineBuilder&,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
GrXferProcessor::DstTexture*,
const SkRect& batchBounds);
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index aef528d096..3ff6807b3b 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -24,16 +24,14 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
const GrXPFactory* xpFactory = builder.getXPFactory();
SkAutoTUnref<GrXferProcessor> xferProcessor;
if (xpFactory) {
- xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts.fColorPOI,
- args.fOpts.fCoveragePOI,
+ xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts,
builder.hasMixedSamples(),
&args.fDstTexture,
*args.fCaps));
} else {
xferProcessor.reset(GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
*args.fCaps,
- args.fOpts.fColorPOI,
- args.fOpts.fCoveragePOI,
+ args.fOpts,
builder.hasMixedSamples(),
&args.fDstTexture));
}
@@ -49,8 +47,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
GrXferProcessor::OptFlags optFlags = GrXferProcessor::kNone_OptFlags;
- optFlags = xferProcessor->getOptimizations(args.fOpts.fColorPOI,
- args.fOpts.fCoveragePOI,
+ optFlags = xferProcessor->getOptimizations(args.fOpts,
builder.getStencil().doesWrite(),
&overrideColor,
*args.fCaps);
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp
index c9dbcd9861..f1d5c26168 100644
--- a/src/gpu/GrPipelineBuilder.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -49,13 +49,12 @@ GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, c
//////////////////////////////////////////////////////////////////////////////s
bool GrPipelineBuilder::willXPNeedDstTexture(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI) const {
+ const GrPipelineOptimizations& optimizations) const {
if (this->getXPFactory()) {
- return this->getXPFactory()->willNeedDstTexture(caps, colorPOI, coveragePOI,
+ return this->getXPFactory()->willNeedDstTexture(caps, optimizations,
this->hasMixedSamples());
}
- return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, colorPOI, coveragePOI,
+ return GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(caps, optimizations,
this->hasMixedSamples());
}
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index 1526b0f68c..f5fe9f80dc 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -177,8 +177,8 @@ public:
/**
* Checks whether the xp will need destination in a texture to correctly blend.
*/
- bool willXPNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI) const;
+ bool willXPNeedDstTexture(const GrCaps& caps,
+ const GrPipelineOptimizations& optimizations) const;
/// @}
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index 655fdfae7b..3bccd6e3f7 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -6,6 +6,7 @@
*/
#include "GrXferProcessor.h"
+#include "GrPipeline.h"
#include "GrPipelineBuilder.h"
#include "GrProcOptInfo.h"
#include "gl/GrGLCaps.h"
@@ -33,13 +34,12 @@ GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture,
}
}
-GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- bool doesStencilWrite,
- GrColor* overrideColor,
- const GrCaps& caps) {
- GrXferProcessor::OptFlags flags = this->onGetOptimizations(colorPOI,
- coveragePOI,
+GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(
+ const GrPipelineOptimizations& optimizations,
+ bool doesStencilWrite,
+ GrColor* overrideColor,
+ const GrCaps& caps) {
+ GrXferProcessor::OptFlags flags = this->onGetOptimizations(optimizations,
doesStencilWrite,
overrideColor,
caps);
@@ -47,7 +47,7 @@ GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo&
if (this->willReadDstColor()) {
// When performing a dst read we handle coverage in the base class.
SkASSERT(!(flags & GrXferProcessor::kIgnoreCoverage_OptFlag));
- if (coveragePOI.isSolidWhite()) {
+ if (optimizations.fCoveragePOI.isSolidWhite()) {
flags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
}
}
@@ -200,13 +200,12 @@ SkString GrXferProcessor::BlendInfo::dump() const {
///////////////////////////////////////////////////////////////////////////////
-GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+GrXferProcessor* GrXPFactory::createXferProcessor(const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture* dstTexture,
const GrCaps& caps) const {
#ifdef SK_DEBUG
- if (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples)) {
+ if (this->willReadDstColor(caps, optimizations, hasMixedSamples)) {
if (!caps.shaderCaps()->dstReadInShaderSupport()) {
SkASSERT(dstTexture && dstTexture->texture());
} else {
@@ -217,13 +216,12 @@ GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
}
SkASSERT(!hasMixedSamples || caps.shaderCaps()->dualSourceBlendingSupport());
#endif
- return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, hasMixedSamples, dstTexture);
+ return this->onCreateXferProcessor(caps, optimizations, hasMixedSamples, dstTexture);
}
bool GrXPFactory::willNeedDstTexture(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) const {
- return (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples) &&
+ return (this->willReadDstColor(caps, optimizations, hasMixedSamples) &&
!caps.shaderCaps()->dstReadInShaderSupport());
}
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index bcdb6d81dc..c7226fc80a 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -32,8 +32,7 @@ public:
private:
CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage);
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* color,
const GrCaps& caps) override;
@@ -107,8 +106,7 @@ GrGLSLXferProcessor* CoverageSetOpXP::createGLSLInstance() const {
}
GrXferProcessor::OptFlags
-CoverageSetOpXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+CoverageSetOpXP::onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* color,
const GrCaps& caps) {
@@ -223,8 +221,7 @@ GrXPFactory* GrCoverageSetOpXPFactory::Create(SkRegion::Op regionOp, bool invert
GrXferProcessor*
GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture* dst) const {
// We don't support inverting coverage with mixed samples. We don't expect to ever want this in
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 90ab030d24..9de178d478 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -11,6 +11,7 @@
#include "GrContext.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
+#include "GrPipeline.h"
#include "GrProcessor.h"
#include "GrTexture.h"
#include "GrTextureAccess.h"
@@ -99,8 +100,7 @@ public:
}
private:
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) override;
@@ -192,8 +192,7 @@ bool CustomXP::onIsEqual(const GrXferProcessor& other) const {
return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation;
}
-GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) {
@@ -294,10 +293,10 @@ GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colo
*/
OptFlags flags = kNone_OptFlags;
- if (colorPOI.allStagesMultiplyInput()) {
+ if (optimizations.fColorPOI.allStagesMultiplyInput()) {
flags |= kCanTweakAlphaForCoverage_OptFlag;
}
- if (this->hasHWBlendEquation() && coveragePOI.isSolidWhite()) {
+ if (this->hasHWBlendEquation() && optimizations.fCoveragePOI.isSolidWhite()) {
flags |= kIgnoreCoverage_OptFlag;
}
return flags;
@@ -326,14 +325,12 @@ public:
private:
GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture*) const override;
bool willReadDstColor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) const override;
bool onIsEqual(const GrXPFactory& xpfBase) const override {
@@ -357,11 +354,10 @@ CustomXPFactory::CustomXPFactory(SkXfermode::Mode mode)
}
GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& opt,
bool hasMixedSamples,
const DstTexture* dstTexture) const {
- if (can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps)) {
+ if (can_use_hw_blend_equation(fHWBlendEquation, opt.fCoveragePOI, caps)) {
SkASSERT(!dstTexture || !dstTexture->texture());
return new CustomXP(fMode, fHWBlendEquation);
}
@@ -369,10 +365,9 @@ GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
}
bool CustomXPFactory::willReadDstColor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) const {
- return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps);
+ return !can_use_hw_blend_equation(fHWBlendEquation, optimizations.fCoveragePOI, caps);
}
void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp
index 2a0de5feda..abeaa8c1cc 100644
--- a/src/gpu/effects/GrDisableColorXP.cpp
+++ b/src/gpu/effects/GrDisableColorXP.cpp
@@ -29,8 +29,7 @@ public:
private:
DisableColorXP();
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* color,
const GrCaps& caps) override {
@@ -96,8 +95,7 @@ GrDisableColorXPFactory::GrDisableColorXPFactory() {
GrXferProcessor*
GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture* dst) const {
return DisableColorXP::Create();
diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h
index a79dd9b971..94aae31751 100644
--- a/src/gpu/effects/GrDisableColorXP.h
+++ b/src/gpu/effects/GrDisableColorXP.h
@@ -27,14 +27,12 @@ private:
GrDisableColorXPFactory();
GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture* dstTexture) const override;
bool willReadDstColor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) const override {
return false;
}
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 2323c67040..88275c2bbe 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -9,6 +9,7 @@
#include "GrBlend.h"
#include "GrCaps.h"
+#include "GrPipeline.h"
#include "GrProcessor.h"
#include "GrProcOptInfo.h"
#include "GrTypes.h"
@@ -352,8 +353,7 @@ public:
BlendFormula getBlendFormula() const { return fBlendFormula; }
private:
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) override;
@@ -469,8 +469,7 @@ GrGLSLXferProcessor* PorterDuffXferProcessor::createGLSLInstance() const {
}
GrXferProcessor::OptFlags
-PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+PorterDuffXferProcessor::onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) {
@@ -486,12 +485,12 @@ PorterDuffXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
if (!fBlendFormula.usesInputColor()) {
optFlags |= GrXferProcessor::kIgnoreColor_OptFlag;
}
- if (coveragePOI.isSolidWhite()) {
+ if (optimizations.fCoveragePOI.isSolidWhite()) {
optFlags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
}
- if (colorPOI.allStagesMultiplyInput() &&
+ if (optimizations.fColorPOI.allStagesMultiplyInput() &&
fBlendFormula.canTweakAlphaForCoverage() &&
- !coveragePOI.isFourChannelOutput()) {
+ !optimizations.fCoveragePOI.isFourChannelOutput()) {
optFlags |= GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag;
}
}
@@ -517,8 +516,8 @@ public:
SkXfermode::Mode getXfermode() const { return fXfermode; }
private:
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo&, const GrProcOptInfo&,
- bool, GrColor*, const GrCaps&) override {
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations&, bool, GrColor*,
+ const GrCaps&) override {
return kNone_OptFlags;
}
@@ -586,8 +585,7 @@ public:
private:
PDLCDXferProcessor(GrColor blendConstant, uint8_t alpha);
- GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+ GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) override;
@@ -676,8 +674,7 @@ GrGLSLXferProcessor* PDLCDXferProcessor::createGLSLInstance() const {
}
GrXferProcessor::OptFlags
-PDLCDXferProcessor::onGetOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
+PDLCDXferProcessor::onGetOptimizations(const GrPipelineOptimizations& optimizations,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) {
@@ -729,24 +726,24 @@ GrXPFactory* GrPorterDuffXPFactory::Create(SkXfermode::Mode xfermode) {
GrXferProcessor*
GrPorterDuffXPFactory::onCreateXferProcessor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const DstTexture* dstTexture) const {
BlendFormula blendFormula;
- if (covPOI.isFourChannelOutput()) {
+ if (optimizations.fCoveragePOI.isFourChannelOutput()) {
if (SkXfermode::kSrcOver_Mode == fXfermode &&
- kRGBA_GrColorComponentFlags == colorPOI.validFlags() &&
+ kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
!caps.shaderCaps()->dualSourceBlendingSupport() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
// If we don't have dual source blending or in shader dst reads, we fall back to this
// trick for rendering SrcOver LCD text instead of doing a dst copy.
SkASSERT(!dstTexture || !dstTexture->texture());
- return PDLCDXferProcessor::Create(fXfermode, colorPOI);
+ return PDLCDXferProcessor::Create(fXfermode, optimizations.fColorPOI);
}
- blendFormula = get_lcd_blend_formula(covPOI, fXfermode);
+ blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, fXfermode);
} else {
- blendFormula = get_blend_formula(colorPOI, covPOI, hasMixedSamples, fXfermode);
+ blendFormula = get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
+ hasMixedSamples, fXfermode);
}
if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
@@ -789,8 +786,7 @@ void GrPorterDuffXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorP
}
bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) const {
if (caps.shaderCaps()->dualSourceBlendingSupport()) {
return false;
@@ -799,17 +795,18 @@ bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
// When we have four channel coverage we always need to read the dst in order to correctly
// blend. The one exception is when we are using srcover mode and we know the input color into
// the XP.
- if (covPOI.isFourChannelOutput()) {
+ if (optimizations.fCoveragePOI.isFourChannelOutput()) {
if (SkXfermode::kSrcOver_Mode == fXfermode &&
- kRGBA_GrColorComponentFlags == colorPOI.validFlags() &&
+ kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
return false;
}
- return get_lcd_blend_formula(covPOI, fXfermode).hasSecondaryOutput();
+ return get_lcd_blend_formula(optimizations.fCoveragePOI, fXfermode).hasSecondaryOutput();
}
// We fallback on the shader XP when the blend formula would use dual source blending but we
// don't have support for it.
- return get_blend_formula(colorPOI, covPOI, hasMixedSamples, fXfermode).hasSecondaryOutput();
+ return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI, hasMixedSamples,
+ fXfermode).hasSecondaryOutput();
}
GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory);
@@ -838,25 +835,24 @@ void GrPorterDuffXPFactory::TestGetXPOutputTypes(const GrXferProcessor* xp,
GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples,
const GrXferProcessor::DstTexture* dstTexture) {
BlendFormula blendFormula;
- if (covPOI.isFourChannelOutput()) {
- if (kRGBA_GrColorComponentFlags == colorPOI.validFlags() &&
+ if (optimizations.fCoveragePOI.isFourChannelOutput()) {
+ if (kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
!caps.shaderCaps()->dualSourceBlendingSupport() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
// If we don't have dual source blending or in shader dst reads, we fall
// back to this trick for rendering SrcOver LCD text instead of doing a
// dst copy.
SkASSERT(!dstTexture || !dstTexture->texture());
- return PDLCDXferProcessor::Create(SkXfermode::kSrcOver_Mode, colorPOI);
+ return PDLCDXferProcessor::Create(SkXfermode::kSrcOver_Mode, optimizations.fColorPOI);
}
- blendFormula = get_lcd_blend_formula(covPOI, SkXfermode::kSrcOver_Mode);
+ blendFormula = get_lcd_blend_formula(optimizations.fCoveragePOI, SkXfermode::kSrcOver_Mode);
} else {
- blendFormula = get_blend_formula(colorPOI, covPOI, hasMixedSamples,
- SkXfermode::kSrcOver_Mode);
+ blendFormula = get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
+ hasMixedSamples, SkXfermode::kSrcOver_Mode);
}
if (blendFormula.hasSecondaryOutput() && !caps.shaderCaps()->dualSourceBlendingSupport()) {
@@ -868,8 +864,7 @@ GrXferProcessor* GrPorterDuffXPFactory::CreateSrcOverXferProcessor(
}
bool GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(const GrCaps& caps,
- const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& covPOI,
+ const GrPipelineOptimizations& optimizations,
bool hasMixedSamples) {
if (caps.shaderCaps()->dstReadInShaderSupport() ||
caps.shaderCaps()->dualSourceBlendingSupport()) {
@@ -879,16 +874,17 @@ bool GrPorterDuffXPFactory::SrcOverWillNeedDstTexture(const GrCaps& caps,
// When we have four channel coverage we always need to read the dst in order to correctly
// blend. The one exception is when we are using srcover mode and we know the input color
// into the XP.
- if (covPOI.isFourChannelOutput()) {
- if (kRGBA_GrColorComponentFlags == colorPOI.validFlags() &&
+ if (optimizations.fCoveragePOI.isFourChannelOutput()) {
+ if (kRGBA_GrColorComponentFlags == optimizations.fColorPOI.validFlags() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
return false;
}
- return get_lcd_blend_formula(covPOI, SkXfermode::kSrcOver_Mode).hasSecondaryOutput();
+ return get_lcd_blend_formula(optimizations.fCoveragePOI,
+ SkXfermode::kSrcOver_Mode).hasSecondaryOutput();
}
// We fallback on the shader XP when the blend formula would use dual source blending but we
// don't have support for it.
- return get_blend_formula(colorPOI, covPOI,
+ return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI,
hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSecondaryOutput();
}