| Index: src/gpu/GrXferProcessor.cpp
|
| diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
|
| index e771f643c7fbfaa46f8348cd2846e6b1e1e29a9a..31ab60661186a2a6dc6f5463f3465138e2487b28 100644
|
| --- a/src/gpu/GrXferProcessor.cpp
|
| +++ b/src/gpu/GrXferProcessor.cpp
|
| @@ -6,17 +6,25 @@
|
| */
|
|
|
| #include "GrXferProcessor.h"
|
| +#include "GrPipelineBuilder.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 GrPipelineBuilder& builder,
|
| + const DstTexture* dstTexture,
|
| + bool willReadDstColor)
|
| : fWillReadDstColor(willReadDstColor)
|
| + , fDstReadUsesMixedSamples(willReadDstColor && builder.hasMixedSamples())
|
| , fReadsCoverage(true)
|
| , fDstTextureOffset() {
|
| if (dstTexture && dstTexture->texture()) {
|
| + SkASSERT(willReadDstColor);
|
| fDstTexture.reset(dstTexture->texture());
|
| fDstTextureOffset = dstTexture->offset();
|
| this->addTextureAccess(&fDstTexture);
|
| @@ -41,12 +49,31 @@ GrXferProcessor::OptFlags GrXferProcessor::getOptimizations(const GrProcOptInfo&
|
| return flags;
|
| }
|
|
|
| +bool GrXferProcessor::hasSecondaryOutput() const {
|
| + if (!this->willReadDstColor()) {
|
| + return this->onHasSecondaryOutput();
|
| + }
|
| + 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;
|
| + }
|
| +}
|
| +
|
| 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 (this->dstReadUsesMixedSamples()) {
|
| + key |= 0x4;
|
| + }
|
| b->add32(key);
|
| this->onGetGLProcessorKey(caps, b);
|
| }
|
| @@ -160,12 +187,13 @@ SkString GrXferProcessor::BlendInfo::dump() const {
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| -GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
|
| +GrXferProcessor* GrXPFactory::createXferProcessor(const GrPipelineBuilder& builder,
|
| + const GrProcOptInfo& colorPOI,
|
| const GrProcOptInfo& coveragePOI,
|
| const DstTexture* dstTexture,
|
| const GrCaps& caps) const {
|
| #ifdef SK_DEBUG
|
| - if (this->willReadDstColor(caps, colorPOI, coveragePOI)) {
|
| + if (this->willReadDstColor(caps, builder, colorPOI, coveragePOI)) {
|
| if (!caps.shaderCaps()->dstReadInShaderSupport()) {
|
| SkASSERT(dstTexture && dstTexture->texture());
|
| } else {
|
| @@ -174,12 +202,15 @@ GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
|
| } else {
|
| SkASSERT(!dstTexture || !dstTexture->texture());
|
| }
|
| + SkASSERT(!builder.hasMixedSamples() || caps.shaderCaps()->dualSourceBlendingSupport());
|
| #endif
|
| - return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstTexture);
|
| + return this->onCreateXferProcessor(caps, builder, colorPOI, coveragePOI, 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 GrPipelineBuilder& builder,
|
| + const GrProcOptInfo& colorPOI,
|
| + const GrProcOptInfo& coveragePOI) const {
|
| + return (this->willReadDstColor(caps, builder, colorPOI, coveragePOI) &&
|
| + !caps.shaderCaps()->dstReadInShaderSupport());
|
| }
|
|
|