Index: src/gpu/GrDefaultGeoProcFactory.cpp |
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp |
index 7d590b2bb4c14662fd7a7f84c533c89f6275d90b..ea52462788d173d65a726077b50eada752f3455b 100644 |
--- a/src/gpu/GrDefaultGeoProcFactory.cpp |
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp |
@@ -24,11 +24,13 @@ |
GrColor color, |
const SkMatrix& viewMatrix, |
const SkMatrix& localMatrix, |
+ bool opaqueVertexColors, |
uint8_t coverage) { |
return SkNEW_ARGS(DefaultGeoProc, (gpTypeFlags, |
color, |
viewMatrix, |
localMatrix, |
+ opaqueVertexColors, |
coverage)); |
} |
@@ -58,7 +60,21 @@ |
} else { |
local->fInputCoverageType = kIgnored_GrGPInput; |
} |
+ |
local->fUsesLocalCoords = init.fUsesLocalCoords; |
+ } |
+ |
+ bool onCanMakeEqual(const GrBatchTracker& m, |
+ const GrGeometryProcessor& that, |
+ const GrBatchTracker& t) const override { |
+ const BatchTracker& mine = m.cast<BatchTracker>(); |
+ const BatchTracker& theirs = t.cast<BatchTracker>(); |
+ return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, |
+ that, theirs.fUsesLocalCoords) && |
+ CanCombineOutput(mine.fInputColorType, mine.fColor, |
+ theirs.fInputColorType, theirs.fColor) && |
+ CanCombineOutput(mine.fInputCoverageType, mine.fCoverage, |
+ theirs.fInputCoverageType, theirs.fCoverage); |
} |
class GLProcessor : public GrGLGeometryProcessor { |
@@ -167,8 +183,9 @@ |
GrColor color, |
const SkMatrix& viewMatrix, |
const SkMatrix& localMatrix, |
+ bool opaqueVertexColors, |
uint8_t coverage) |
- : INHERITED(color, viewMatrix, localMatrix) |
+ : INHERITED(color, viewMatrix, localMatrix, opaqueVertexColors) |
, fInPosition(NULL) |
, fInColor(NULL) |
, fInLocalCoords(NULL) |
@@ -182,6 +199,7 @@ |
fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); |
if (hasColor) { |
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType)); |
+ this->setHasVertexColor(); |
} |
if (hasLocalCoord) { |
fInLocalCoords = &this->addVertexAttrib(Attribute("inLocalCoord", |
@@ -191,6 +209,20 @@ |
if (hasCoverage) { |
fInCoverage = &this->addVertexAttrib(Attribute("inCoverage", |
kFloat_GrVertexAttribType)); |
+ } |
+ } |
+ |
+ bool onIsEqual(const GrGeometryProcessor& other) const override { |
+ const DefaultGeoProc& gp = other.cast<DefaultGeoProc>(); |
+ return gp.fFlags == this->fFlags; |
+ } |
+ |
+ void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
+ if (fInCoverage) { |
+ out->setUnknownSingleComponent(); |
+ } else { |
+ // uniform coverage |
+ out->setKnownSingleComponent(this->coverage()); |
} |
} |
@@ -235,6 +267,7 @@ |
GrRandomColor(random), |
GrProcessorUnitTest::TestMatrix(random), |
GrProcessorUnitTest::TestMatrix(random), |
+ random->nextBool(), |
GrRandomCoverage(random)); |
} |
@@ -242,10 +275,12 @@ |
GrColor color, |
const SkMatrix& viewMatrix, |
const SkMatrix& localMatrix, |
+ bool opaqueVertexColors, |
uint8_t coverage) { |
return DefaultGeoProc::Create(gpTypeFlags, |
color, |
viewMatrix, |
localMatrix, |
+ opaqueVertexColors, |
coverage); |
} |