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

Unified Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 1110993002: Revert of removing equality / compute invariant loops from GrGeometryProcessors (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup1
Patch Set: Created 5 years, 8 months 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/GrDefaultGeoProcFactory.h ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.h ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698