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

Unified Diff: src/gpu/GrXferProcessor.cpp

Issue 1170553002: Apply coverage in XP base class when using dst reads (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_reenablebea
Patch Set: names Created 5 years, 6 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/effects/SkArithmeticMode_gpu.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrXferProcessor.cpp
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index e771f643c7fbfaa46f8348cd2846e6b1e1e29a9a..837e13e2a62ba9b8b54e1d87813f8342d5a14853 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -6,6 +6,7 @@
*/
#include "GrXferProcessor.h"
+#include "GrProcOptInfo.h"
#include "gl/GrGLCaps.h"
GrXferProcessor::GrXferProcessor()
@@ -17,6 +18,7 @@ GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture, bool willReadDstC
, fReadsCoverage(true)
, fDstTextureOffset() {
if (dstTexture && dstTexture->texture()) {
+ SkASSERT(willReadDstColor);
fDstTexture.reset(dstTexture->texture());
fDstTextureOffset = dstTexture->offset();
this->addTextureAccess(&fDstTexture);
@@ -35,17 +37,45 @@ GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo&
overrideColor,
caps);
+ if (this->willReadDstColor()) {
+ // When performing a dst read we handle coverage in the base class.
+ SkASSERT(!(flags & GrXferProcessor::kIgnoreCoverage_OptFlag));
+ if (coveragePOI.isSolidWhite()) {
+ flags |= GrXferProcessor::kIgnoreCoverage_OptFlag;
+ }
+ }
if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
fReadsCoverage = false;
}
return flags;
}
+bool GrXferProcessor::hasSecondaryOutput() const {
+ if (!this->willReadDstColor()) {
+ return this->onHasSecondaryOutput();
+ }
+ return false;
+}
+
+void GrXferProcessor::getBlendInfo(BlendInfo* blendInfo) const {
+ blendInfo->reset();
+ if (!this->willReadDstColor()) {
+ this->onGetBlendInfo(blendInfo);
+ }
+}
+
void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const {
uint32_t key = this->willReadDstColor() ? 0x1 : 0x0;
- if (this->getDstTexture() &&
- kTopLeft_GrSurfaceOrigin == this->getDstTexture()->origin()) {
- key |= 0x2;
+ if (key) {
+ if (this->getDstTexture()) {
+ key |= 0x2;
+ }
+ if (kTopLeft_GrSurfaceOrigin == this->getDstTexture()->origin()) {
+ key |= 0x4;
+ }
+ if (this->readsCoverage()) {
+ key |= 0x8;
+ }
}
b->add32(key);
this->onGetGLProcessorKey(caps, b);
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698