Index: src/gpu/GrOptDrawState.cpp |
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp |
index 409305ce33fae912d79acbd2f3964ed589d4464a..b4c1a60b477702f4ec30f4767760c5427635aa58 100644 |
--- a/src/gpu/GrOptDrawState.cpp |
+++ b/src/gpu/GrOptDrawState.cpp |
@@ -44,7 +44,8 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
drawState.isColorWriteDisabled(), |
drawState.getStencil().doesWrite(), |
&fColor, |
- &fCoverage); |
+ &fCoverage, |
+ caps); |
} |
// When path rendering the stencil settings are not always set on the draw state |
@@ -56,9 +57,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
// indicate that this can be skipped. |
fFlags = 0; |
fDrawFace = GrDrawState::kInvalid_DrawFace; |
- fSrcBlend = kZero_GrBlendCoeff; |
- fDstBlend = kZero_GrBlendCoeff; |
- fBlendConstant = 0x0; |
fViewMatrix.reset(); |
return; |
} |
@@ -108,9 +106,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
GrXferProcessor::BlendInfo blendInfo; |
fXferProcessor->getBlendInfo(&blendInfo); |
- fSrcBlend = blendInfo.fSrcBlend; |
- fDstBlend = blendInfo.fDstBlend; |
- fBlendConstant = blendInfo.fBlendConstant; |
this->adjustProgramFromOptimizations(drawState, optFlags, colorPOI, coveragePOI, |
&firstColorStageIdx, &firstCoverageStageIdx); |
@@ -146,42 +141,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
init.fCoverage = this->getCoverage(); |
fGeometryProcessor->initBatchTracker(&fBatchTracker, init); |
} |
- |
- this->setOutputStateInfo(drawState, coverageColor, optFlags, caps); |
-} |
- |
-void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
- GrColor coverage, |
- GrXferProcessor::OptFlags optFlags, |
- const GrDrawTargetCaps& caps) { |
- // Set this default and then possibly change our mind if there is coverage. |
- fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
- fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
- |
- // Determine whether we should use dual source blending or shader code to keep coverage |
- // separate from color. |
- bool keepCoverageSeparate = !(optFlags & GrXferProcessor::kSetCoverageDrawing_OptFlag); |
- if (keepCoverageSeparate && !ds.hasSolidCoverage(coverage)) { |
- if (caps.dualSourceBlendingSupport()) { |
- if (kZero_GrBlendCoeff == fDstBlend) { |
- // write the coverage value to second color |
- fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverage_SecondaryOutputType; |
- fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
- } else if (kSA_GrBlendCoeff == fDstBlend) { |
- // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. |
- fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverageISA_SecondaryOutputType; |
- fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
- } else if (kSC_GrBlendCoeff == fDstBlend) { |
- // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. |
- fDescInfo.fSecondaryOutputType = GrProgramDesc::kCoverageISC_SecondaryOutputType; |
- fDstBlend = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff; |
- } |
- } else if (fDescInfo.fReadsDst && |
- kOne_GrBlendCoeff == fSrcBlend && |
- kZero_GrBlendCoeff == fDstBlend) { |
- fDescInfo.fPrimaryOutputType = GrProgramDesc::kCombineWithDst_PrimaryOutputType; |
- } |
- } |
} |
void GrOptDrawState::adjustProgramFromOptimizations(const GrDrawState& ds, |
@@ -237,10 +196,7 @@ bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
this->fNumColorStages != that.fNumColorStages || |
this->fScissorState != that.fScissorState || |
!this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || |
- this->fSrcBlend != that.fSrcBlend || |
- this->fDstBlend != that.fDstBlend || |
this->fDrawType != that.fDrawType || |
- this->fBlendConstant != that.fBlendConstant || |
this->fFlags != that.fFlags || |
this->fStencilSettings != that.fStencilSettings || |
this->fDrawFace != that.fDrawFace || |
@@ -262,6 +218,10 @@ bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
return false; |
} |
+ if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { |
+ return false; |
+ } |
+ |
// The program desc comparison should have already assured that the stage counts match. |
SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
for (int i = 0; i < this->numFragmentStages(); i++) { |