diff options
author | 2015-08-12 11:14:50 -0700 | |
---|---|---|
committer | 2015-08-12 11:14:50 -0700 | |
commit | cb02b38b2c48bfde333ce3c699dd0451e2d867fa (patch) | |
tree | fe4c1f40874588934ae4b07405dcdc9fc456bfa8 /src/gpu/batches | |
parent | 6028a8476504022fe40b6870b1460b5e4a80969f (diff) |
Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu
Review URL: https://codereview.chromium.org/1287973003
Diffstat (limited to 'src/gpu/batches')
-rw-r--r-- | src/gpu/batches/GrAAFillRectBatch.cpp | 6 | ||||
-rw-r--r-- | src/gpu/batches/GrAAFillRectBatch.h | 2 | ||||
-rw-r--r-- | src/gpu/batches/GrAAStrokeRectBatch.cpp | 5 | ||||
-rw-r--r-- | src/gpu/batches/GrAAStrokeRectBatch.h | 2 | ||||
-rw-r--r-- | src/gpu/batches/GrBatch.h | 8 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawAtlasBatch.cpp | 5 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawAtlasBatch.h | 2 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawVerticesBatch.cpp | 5 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawVerticesBatch.h | 2 | ||||
-rw-r--r-- | src/gpu/batches/GrRectBatch.cpp | 5 | ||||
-rw-r--r-- | src/gpu/batches/GrRectBatch.h | 2 | ||||
-rw-r--r-- | src/gpu/batches/GrStrokeRectBatch.h | 9 | ||||
-rw-r--r-- | src/gpu/batches/GrTestBatch.h | 2 |
13 files changed, 29 insertions, 26 deletions
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp index 582d2e8e04..73a0c4bad7 100644 --- a/src/gpu/batches/GrAAFillRectBatch.cpp +++ b/src/gpu/batches/GrAAFillRectBatch.cpp @@ -130,7 +130,6 @@ public: args.fDevRect, canTweakAlphaForCoverage); } - helper.issueDraw(batchTarget); } @@ -176,8 +175,9 @@ private: const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } bool coverageIgnored() const { return fBatch.fCoverageIgnored; } - bool onCombineIfPossible(GrBatch* t) override { - if (!this->pipeline()->isEqual(*t->pipeline())) { + bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) { + if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(), + caps)) { return false; } diff --git a/src/gpu/batches/GrAAFillRectBatch.h b/src/gpu/batches/GrAAFillRectBatch.h index 6ce8f513fe..9344695f09 100644 --- a/src/gpu/batches/GrAAFillRectBatch.h +++ b/src/gpu/batches/GrAAFillRectBatch.h @@ -15,12 +15,10 @@ class SkMatrix; struct SkRect; namespace GrAAFillRectBatch { - GrBatch* Create(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect, const SkRect& devRect); - }; #endif diff --git a/src/gpu/batches/GrAAStrokeRectBatch.cpp b/src/gpu/batches/GrAAStrokeRectBatch.cpp index fa88fd13df..0083aaad6c 100644 --- a/src/gpu/batches/GrAAStrokeRectBatch.cpp +++ b/src/gpu/batches/GrAAStrokeRectBatch.cpp @@ -203,8 +203,9 @@ const GrIndexBuffer* GrAAStrokeRectBatch::GetIndexBuffer(GrResourceProvider* res } } -bool GrAAStrokeRectBatch::onCombineIfPossible(GrBatch* t) { - if (!this->pipeline()->isEqual(*t->pipeline())) { +bool GrAAStrokeRectBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { + if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(), + caps)) { return false; } diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h index b1222c9204..7fa15f5326 100644 --- a/src/gpu/batches/GrAAStrokeRectBatch.h +++ b/src/gpu/batches/GrAAStrokeRectBatch.h @@ -78,7 +78,7 @@ private: bool miterStroke() const { return fBatch.fMiterStroke; } bool coverageIgnored() const { return fBatch.fCoverageIgnored; } - bool onCombineIfPossible(GrBatch* t) override; + bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; void generateAAStrokeRectGeometry(void* vertices, size_t offset, diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h index 815369124a..35844cd99a 100644 --- a/src/gpu/batches/GrBatch.h +++ b/src/gpu/batches/GrBatch.h @@ -54,16 +54,14 @@ public: virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0; - bool combineIfPossible(GrBatch* that) { + bool combineIfPossible(GrBatch* that, const GrCaps& caps) { if (this->classID() != that->classID()) { return false; } - return this->onCombineIfPossible(that); + return this->onCombineIfPossible(that, caps); } - virtual bool onCombineIfPossible(GrBatch*) = 0; - virtual void generateGeometry(GrBatchTarget*) = 0; const SkRect& bounds() const { return fBounds; } @@ -162,6 +160,8 @@ protected: SkRect fBounds; private: + virtual bool onCombineIfPossible(GrBatch*, const GrCaps& caps) = 0; + /* * initBatchTracker is a hook for the some additional overrides / optimization possibilities * from the GrXferProcessor. diff --git a/src/gpu/batches/GrDrawAtlasBatch.cpp b/src/gpu/batches/GrDrawAtlasBatch.cpp index 9bc7753e26..ba3551d459 100644 --- a/src/gpu/batches/GrDrawAtlasBatch.cpp +++ b/src/gpu/batches/GrDrawAtlasBatch.cpp @@ -156,8 +156,9 @@ GrDrawAtlasBatch::GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& vie this->setBounds(bounds); } -bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t) { - if (!this->pipeline()->isEqual(*t->pipeline())) { +bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { + if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(), + caps)) { return false; } diff --git a/src/gpu/batches/GrDrawAtlasBatch.h b/src/gpu/batches/GrDrawAtlasBatch.h index bc882b2bfa..e6ce7a03df 100644 --- a/src/gpu/batches/GrDrawAtlasBatch.h +++ b/src/gpu/batches/GrDrawAtlasBatch.h @@ -56,7 +56,7 @@ private: int quadCount() const { return fQuadCount; } bool coverageIgnored() const { return fCoverageIgnored; } - bool onCombineIfPossible(GrBatch* t) override; + bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; SkSTArray<1, Geometry, true> fGeoData; SkMatrix fViewMatrix; diff --git a/src/gpu/batches/GrDrawVerticesBatch.cpp b/src/gpu/batches/GrDrawVerticesBatch.cpp index 397bb2b8f1..f36c54b067 100644 --- a/src/gpu/batches/GrDrawVerticesBatch.cpp +++ b/src/gpu/batches/GrDrawVerticesBatch.cpp @@ -183,8 +183,9 @@ void GrDrawVerticesBatch::generateGeometry(GrBatchTarget* batchTarget) { batchTarget->draw(vertices); } -bool GrDrawVerticesBatch::onCombineIfPossible(GrBatch* t) { - if (!this->pipeline()->isEqual(*t->pipeline())) { +bool GrDrawVerticesBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { + if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(), + caps)) { return false; } diff --git a/src/gpu/batches/GrDrawVerticesBatch.h b/src/gpu/batches/GrDrawVerticesBatch.h index a59518a8fe..9446d88bde 100644 --- a/src/gpu/batches/GrDrawVerticesBatch.h +++ b/src/gpu/batches/GrDrawVerticesBatch.h @@ -75,7 +75,7 @@ private: int indexCount() const { return fBatch.fIndexCount; } bool coverageIgnored() const { return fBatch.fCoverageIgnored; } - bool onCombineIfPossible(GrBatch* t) override; + bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; struct BatchTracker { GrPrimitiveType fPrimitiveType; diff --git a/src/gpu/batches/GrRectBatch.cpp b/src/gpu/batches/GrRectBatch.cpp index 1cfa093613..1d5b9f305b 100644 --- a/src/gpu/batches/GrRectBatch.cpp +++ b/src/gpu/batches/GrRectBatch.cpp @@ -80,8 +80,9 @@ void GrRectBatch::generateGeometry(GrBatchTarget* batchTarget) { helper.issueDraw(batchTarget); } -bool GrRectBatch::onCombineIfPossible(GrBatch* t) { - if (!this->pipeline()->isEqual(*t->pipeline())) { +bool GrRectBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { + if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(), + caps)) { return false; } diff --git a/src/gpu/batches/GrRectBatch.h b/src/gpu/batches/GrRectBatch.h index aa227d46ff..3f13ef5bb5 100644 --- a/src/gpu/batches/GrRectBatch.h +++ b/src/gpu/batches/GrRectBatch.h @@ -66,7 +66,7 @@ private: bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; } bool coverageIgnored() const { return fBatch.fCoverageIgnored; } - bool onCombineIfPossible(GrBatch* t) override; + bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; const GrGeometryProcessor* createRectGP(); diff --git a/src/gpu/batches/GrStrokeRectBatch.h b/src/gpu/batches/GrStrokeRectBatch.h index 3a20d9bfcb..7979a6492d 100644 --- a/src/gpu/batches/GrStrokeRectBatch.h +++ b/src/gpu/batches/GrStrokeRectBatch.h @@ -50,10 +50,11 @@ private: bool hairline() const { return fBatch.fHairline; } bool coverageIgnored() const { return fBatch.fCoverageIgnored; } - bool onCombineIfPossible(GrBatch* t) override { - //if (!this->pipeline()->isEqual(*t->pipeline())) { - // return false; - //} + bool onCombineIfPossible(GrBatch* t, const GrCaps&) override { + // if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), + // t->bounds(), caps)) { + // return false; + // } // GrStrokeRectBatch* that = t->cast<StrokeRectBatch>(); // NonAA stroke rects cannot batch right now diff --git a/src/gpu/batches/GrTestBatch.h b/src/gpu/batches/GrTestBatch.h index 55cc5c25a5..68ea676d25 100644 --- a/src/gpu/batches/GrTestBatch.h +++ b/src/gpu/batches/GrTestBatch.h @@ -66,7 +66,7 @@ private: virtual Geometry* geoData(int index) = 0; virtual const Geometry* geoData(int index) const = 0; - bool onCombineIfPossible(GrBatch* t) override { + bool onCombineIfPossible(GrBatch* t, const GrCaps&) override { return false; } |