Disable blending when there is an effect that reads the dst and draw state blend is 1,0.

R=robertphillips@google.com

Review URL: https://codereview.chromium.org/15199008

git-svn-id: http://skia.googlecode.com/svn/trunk@9147 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2013-05-15 17:53:04 +00:00
parent d09ab84678
commit 0c89db2929
2 changed files with 9 additions and 2 deletions

View File

@ -371,6 +371,13 @@ GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage,
return kCoverageAsAlpha_BlendOptFlag;
}
}
if (kOne_GrBlendCoeff == *srcCoeff &&
kZero_GrBlendCoeff == *dstCoeff &&
this->willEffectReadDstColor()) {
// In this case the shader will fully resolve the color, coverage, and dst and we don't
// need blending.
return kDisableBlend_BlendOptFlag;
}
return kNone_BlendOpt;
}

View File

@ -178,8 +178,8 @@ void GrGLProgramDesc::Build(const GrDrawState& drawState,
desc->fFirstCoverageStage = firstCoverageStage;
}
} else if (readsDst &&
kOne_GrBlendCoeff == drawState.getSrcBlendCoeff() &&
kZero_GrBlendCoeff == drawState.getDstBlendCoeff()) {
kOne_GrBlendCoeff == srcCoeff &&
kZero_GrBlendCoeff == dstCoeff) {
desc->fCoverageOutput = kCombineWithDst_CoverageOutput;
desc->fFirstCoverageStage = firstCoverageStage;
}