Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: src/gpu/effects/GrCustomXfermode.cpp

Issue 1125283005: Only discard for XP dstCopies if we have a coverage value. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDisableColorXP.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrCustomXfermode.cpp
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index b15e2c2b9a133ad47bae7cd672a65bec36a2fbee..0a525b4d9279933a4334b1fe19c7ac89a5cc020a 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -525,14 +525,7 @@ public:
bool hasSecondaryOutput() const override { return false; }
- GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- bool doesStencilWrite,
- GrColor* overrideColor,
- const GrDrawTargetCaps& caps) override;
-
SkXfermode::Mode mode() const { return fMode; }
- bool hasCoverage() const { return fHasCoverage; }
bool hasHWBlendEquation() const { return kInvalid_GrBlendEquation != fHWBlendEquation; }
GrBlendEquation hwBlendEquation() const {
@@ -543,6 +536,12 @@ public:
private:
CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
+ GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool doesStencilWrite,
+ GrColor* overrideColor,
+ const GrDrawTargetCaps& caps) override;
+
void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
bool onWillNeedXferBarrier(const GrRenderTarget* rt,
@@ -554,7 +553,6 @@ private:
bool onIsEqual(const GrXferProcessor& xpBase) const override;
SkXfermode::Mode fMode;
- bool fHasCoverage;
GrBlendEquation fHWBlendEquation;
typedef GrXferProcessor INHERITED;
@@ -581,7 +579,7 @@ public:
const CustomXP& xp = p.cast<CustomXP>();
uint32_t key = xp.numTextures();
SkASSERT(key <= 1);
- key |= xp.hasCoverage() << 1;
+ key |= xp.readsCoverage() << 1;
if (xp.hasHWBlendEquation()) {
SkASSERT(caps.advBlendEqInteraction() > 0); // 0 will mean !xp.hasHWBlendEquation().
key |= caps.advBlendEqInteraction() << 2;
@@ -601,7 +599,7 @@ private:
if (xp.hasHWBlendEquation()) {
// The blend mode will be implemented in hardware; only output the src color.
fsBuilder->enableAdvancedBlendEquationIfNeeded(xp.hwBlendEquation());
- if (xp.hasCoverage()) {
+ if (xp.readsCoverage()) {
// Do coverage modulation by multiplying it into the src color before blending.
// (See getOptimizations())
fsBuilder->codeAppendf("%s = %s * %s;",
@@ -613,7 +611,7 @@ private:
const char* dstColor = fsBuilder->dstColor();
emit_custom_xfermode_code(xp.mode(), fsBuilder, args.fOutputPrimary, args.fInputColor,
dstColor);
- if (xp.hasCoverage()) {
+ if (xp.readsCoverage()) {
fsBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
args.fOutputPrimary, args.fOutputPrimary,
args.fInputCoverage, args.fInputCoverage, dstColor);
@@ -632,7 +630,6 @@ CustomXP::CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy,
bool willReadDstColor)
: INHERITED(dstCopy, willReadDstColor),
fMode(mode),
- fHasCoverage(true),
fHWBlendEquation(kInvalid_GrBlendEquation) {
this->initClassID<CustomXP>();
}
@@ -648,12 +645,10 @@ GrGLXferProcessor* CustomXP::createGLInstance() const {
bool CustomXP::onIsEqual(const GrXferProcessor& other) const {
const CustomXP& s = other.cast<CustomXP>();
- return fMode == s.fMode &&
- fHasCoverage == s.fHasCoverage &&
- fHWBlendEquation == s.fHWBlendEquation;
+ return fMode == s.fMode && fHWBlendEquation == s.fHWBlendEquation;
}
-GrXferProcessor::OptFlags CustomXP::getOptimizations(const GrProcOptInfo& colorPOI,
+GrXferProcessor::OptFlags CustomXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
bool doesStencilWrite,
GrColor* overrideColor,
@@ -760,7 +755,6 @@ GrXferProcessor::OptFlags CustomXP::getOptimizations(const GrProcOptInfo& colorP
}
if (coveragePOI.isSolidWhite()) {
flags = flags | kIgnoreCoverage_OptFlag;
- fHasCoverage = false;
}
if (caps.advancedBlendEquationSupport() && !coveragePOI.isFourChannelOutput()) {
// This blend mode can be implemented in hardware.
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDisableColorXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698