aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-07-16 09:13:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-16 09:13:51 -0700
commit8cab9a7685e872427e6f0388f149575a9b6016ee (patch)
tree7e9456dfab4ac0def923aef86520e3cb0fcf6c8b /src
parente8d21e8f24aa676765d0ff8f433228665c75cdc2 (diff)
All batches do their own pipeline compare
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp4
-rwxr-xr-xsrc/gpu/GrAADistanceFieldPathRenderer.cpp4
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp4
-rw-r--r--src/gpu/GrAALinearizingConvexPathRenderer.cpp4
-rw-r--r--src/gpu/GrAARectRenderer.cpp8
-rw-r--r--src/gpu/GrAtlasTextContext.cpp4
-rw-r--r--src/gpu/GrBatch.h7
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp4
-rw-r--r--src/gpu/GrDrawContext.cpp7
-rw-r--r--src/gpu/GrOvalRenderer.cpp20
-rw-r--r--src/gpu/GrPipeline.cpp5
-rw-r--r--src/gpu/GrRectBatch.cpp4
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp4
13 files changed, 73 insertions, 6 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index fed6a7afd7..7e65fccc45 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -938,6 +938,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
AAConvexPathBatch* that = t->cast<AAConvexPathBatch>();
if (this->color() != that->color()) {
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index ca0f4e3d65..830232b4c4 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -501,6 +501,10 @@ private:
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>();
// TODO we could actually probably do a bunch of this work on the CPU, ie map viewMatrix,
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 8a0c9a4f57..6b1f8a41f7 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -736,6 +736,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
AAHairlineBatch* that = t->cast<AAHairlineBatch>();
if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspective()) {
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
index 31d61a4257..d899e7d084 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
@@ -261,6 +261,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch>();
SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index f59b61125b..93b276ad43 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -175,6 +175,10 @@ private:
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
AAFillRectBatch* that = t->cast<AAFillRectBatch>();
SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
@@ -617,6 +621,10 @@ private:
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
AAStrokeRectBatch* that = t->cast<AAStrokeRectBatch>();
// TODO batch across miterstroke changes
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 73526ed4d5..868f8bbe8e 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1873,6 +1873,10 @@ private:
int numGlyphs() const { return fBatch.fNumGlyphs; }
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
BitmapTextBatch* that = t->cast<BitmapTextBatch>();
if (fUseDistanceFields != that->fUseDistanceFields) {
diff --git a/src/gpu/GrBatch.h b/src/gpu/GrBatch.h
index b77011268b..51c556e737 100644
--- a/src/gpu/GrBatch.h
+++ b/src/gpu/GrBatch.h
@@ -57,10 +57,6 @@ public:
return false;
}
- if (!this->pipeline()->isEqual(*that->pipeline())) {
- return false;
- }
-
return this->onCombineIfPossible(that);
}
@@ -97,6 +93,7 @@ public:
SkDEBUGCODE(bool isUsed() const { return fUsed; })
+ const GrPipeline* pipeline() const { return fPipeline; }
void setPipeline(const GrPipeline* pipeline) { fPipeline.reset(SkRef(pipeline)); }
protected:
@@ -113,8 +110,6 @@ protected:
return fBounds.joinPossiblyEmptyRect(otherBounds);
}
- const GrPipeline* pipeline() const { return fPipeline; }
-
/** Helper for rendering instances using an instanced index index buffer. This class creates the
space for the vertices and flushes the draws to the batch target.*/
class InstancedHelper {
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index e02e082b56..77af9e9856 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -384,6 +384,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
DefaultPathBatch* that = t->cast<DefaultPathBatch>();
if (this->color() != that->color()) {
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 77a18677a6..eabdfd2059 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -397,6 +397,9 @@ private:
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
+ //if (!this->pipeline()->isEqual(*t->pipeline())) {
+ // return false;
+ //}
// StrokeRectBatch* that = t->cast<StrokeRectBatch>();
// NonAA stroke rects cannot batch right now
@@ -762,6 +765,10 @@ private:
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
DrawVerticesBatch* that = t->cast<DrawVerticesBatch>();
if (!this->batchablePrimitiveType() || this->primitiveType() != that->primitiveType()) {
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 88b2f3eb77..d337bbb365 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -734,6 +734,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
CircleBatch* that = t->cast<CircleBatch>();
// TODO use vertex color to avoid breaking batches
@@ -953,6 +957,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
EllipseBatch* that = t->cast<EllipseBatch>();
// TODO use vertex color to avoid breaking batches
@@ -1207,6 +1215,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
DIEllipseBatch* that = t->cast<DIEllipseBatch>();
// TODO use vertex color to avoid breaking batches
@@ -1580,6 +1592,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>();
// TODO use vertex color to avoid breaking batches
@@ -1762,6 +1778,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>();
// TODO use vertex color to avoid breaking batches
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 8c40438a27..c3b8e77c1a 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -153,6 +153,11 @@ void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin
////////////////////////////////////////////////////////////////////////////////
bool GrPipeline::isEqual(const GrPipeline& that) const {
+ // If we point to the same pipeline, then we are necessarily equal
+ if (this == &that) {
+ return true;
+ }
+
if (this->getRenderTarget() != that.getRenderTarget() ||
this->fFragmentStages.count() != that.fFragmentStages.count() ||
this->fNumColorStages != that.fNumColorStages ||
diff --git a/src/gpu/GrRectBatch.cpp b/src/gpu/GrRectBatch.cpp
index 222aaef8a9..6933dc1c57 100644
--- a/src/gpu/GrRectBatch.cpp
+++ b/src/gpu/GrRectBatch.cpp
@@ -173,6 +173,10 @@ private:
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
RectBatch* that = t->cast<RectBatch>();
if (this->hasLocalRect() != that->hasLocalRect()) {
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 18cd3d12ac..f6fe81ba36 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -620,6 +620,10 @@ private:
}
bool onCombineIfPossible(GrBatch* t) override {
+ if (!this->pipeline()->isEqual(*t->pipeline())) {
+ return false;
+ }
+
DashBatch* that = t->cast<DashBatch>();
if (this->aaMode() != that->aaMode()) {