All batches do their own pipeline compare

BUG=skia:

Review URL: https://codereview.chromium.org/1242033002
This commit is contained in:
joshualitt 2015-07-16 09:13:50 -07:00 committed by Commit bot
parent e8d21e8f24
commit 8cab9a7685
13 changed files with 73 additions and 6 deletions

View File

@ -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()) {

View File

@ -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,

View File

@ -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()) {

View File

@ -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());

View File

@ -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

View File

@ -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) {

View File

@ -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 {

View File

@ -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()) {

View File

@ -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()) {

View File

@ -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

View File

@ -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 ||

View File

@ -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()) {

View File

@ -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()) {