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

Unified Diff: src/gpu/GrXferProcessor.cpp

Issue 1164973002: Add mixed samples support to XPs (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_reenablebea
Patch Set: 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/gpu/GrPipelineBuilder.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 67c5dd81a233356b822a8495e038d62066619e70..1ead010b6eace6df63dd2eaa27b81e9b05b8fff4 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -6,15 +6,22 @@
*/
#include "GrXferProcessor.h"
+#include "GrPipelineBuilder.h"
#include "GrProcOptInfo.h"
#include "gl/GrGLCaps.h"
GrXferProcessor::GrXferProcessor()
- : fWillReadDstColor(false), fReadsCoverage(true), fDstTextureOffset() {
+ : fWillReadDstColor(false)
+ , fDstReadUsesMixedSamples(false)
+ , fReadsCoverage(true)
+ , fDstTextureOffset() {
}
-GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture, bool willReadDstColor)
+GrXferProcessor::GrXferProcessor(const DstTexture* dstTexture,
+ bool willReadDstColor,
+ bool hasMixedSamples)
: fWillReadDstColor(willReadDstColor)
+ , fDstReadUsesMixedSamples(willReadDstColor && hasMixedSamples)
, fReadsCoverage(true)
, fDstTextureOffset() {
if (dstTexture && dstTexture->texture()) {
@@ -54,13 +61,15 @@ bool GrXferProcessor::hasSecondaryOutput() const {
if (!this->willReadDstColor()) {
return this->onHasSecondaryOutput();
}
- return false;
+ return this->dstReadUsesMixedSamples();
}
void GrXferProcessor::getBlendInfo(BlendInfo* blendInfo) const {
blendInfo->reset();
if (!this->willReadDstColor()) {
this->onGetBlendInfo(blendInfo);
+ } else if (this->dstReadUsesMixedSamples()) {
+ blendInfo->fDstBlend = kIS2A_GrBlendCoeff;
}
}
@@ -76,6 +85,9 @@ void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu
if (this->readsCoverage()) {
key |= 0x8;
}
+ if (this->dstReadUsesMixedSamples()) {
+ key |= 0x10;
+ }
}
b->add32(key);
this->onGetGLProcessorKey(caps, b);
@@ -192,10 +204,11 @@ SkString GrXferProcessor::BlendInfo::dump() const {
GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,
+ bool hasMixedSamples,
const DstTexture* dstTexture,
const GrCaps& caps) const {
#ifdef SK_DEBUG
- if (this->willReadDstColor(caps, colorPOI, coveragePOI)) {
+ if (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples)) {
if (!caps.shaderCaps()->dstReadInShaderSupport()) {
SkASSERT(dstTexture && dstTexture->texture());
} else {
@@ -204,12 +217,15 @@ GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
} else {
SkASSERT(!dstTexture || !dstTexture->texture());
}
+ SkASSERT(!hasMixedSamples || caps.shaderCaps()->dualSourceBlendingSupport());
#endif
- return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstTexture);
+ return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, hasMixedSamples, dstTexture);
}
-bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI) const {
- return (this->willReadDstColor(caps, colorPOI, coveragePOI)
- && !caps.shaderCaps()->dstReadInShaderSupport());
+bool GrXPFactory::willNeedDstTexture(const GrCaps& caps,
+ const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool hasMixedSamples) const {
+ return (this->willReadDstColor(caps, colorPOI, coveragePOI, hasMixedSamples) &&
+ !caps.shaderCaps()->dstReadInShaderSupport());
}
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698