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

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 791143002: Fix to set correct output type when blending when we've read dst (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Merging follow up fix cls Created 6 years 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/GrOptDrawState.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOptDrawState.cpp
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index 409305ce33fae912d79acbd2f3964ed589d4464a..9ebe551d6bc5d5fa141f94854ca75e17ebf17daf 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
@@ -146,42 +147,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,
@@ -262,6 +227,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++) {
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698