Index: src/gpu/GrBatch.h |
diff --git a/src/gpu/GrBatch.h b/src/gpu/GrBatch.h |
index 21dc3d21c88fd75f3f33afaa184f1be78ba206cf..b77011268b5a23489deb55b76278a5f0e5620efd 100644 |
--- a/src/gpu/GrBatch.h |
+++ b/src/gpu/GrBatch.h |
@@ -11,9 +11,9 @@ |
#include <new> |
#include "GrBatchTarget.h" |
#include "GrGeometryProcessor.h" |
+#include "GrNonAtomicRef.h" |
#include "GrVertices.h" |
#include "SkAtomics.h" |
-#include "SkRefCnt.h" |
#include "SkTypes.h" |
class GrGpu; |
@@ -37,9 +37,8 @@ struct GrInitInvariantOutput; |
* information will be communicated to the GrBatch prior to geometry generation. |
*/ |
-class GrBatch : public SkRefCnt { |
+class GrBatch : public GrNonAtomicRef { |
public: |
- |
GrBatch() : fClassID(kIllegalBatchClassID), fNumberOfDraws(0) { SkDEBUGCODE(fUsed = false;) } |
virtual ~GrBatch() {} |
@@ -58,6 +57,10 @@ public: |
return false; |
} |
+ if (!this->pipeline()->isEqual(*that->pipeline())) { |
+ return false; |
+ } |
+ |
return this->onCombineIfPossible(that); |
} |
@@ -94,14 +97,14 @@ public: |
SkDEBUGCODE(bool isUsed() const { return fUsed; }) |
+ void setPipeline(const GrPipeline* pipeline) { fPipeline.reset(SkRef(pipeline)); } |
+ |
protected: |
template <typename PROC_SUBCLASS> void initClassID() { |
static uint32_t kClassID = GenClassID(); |
fClassID = kClassID; |
} |
- uint32_t fClassID; |
- |
// NOTE, compute some bounds, even if extremely conservative. Do *NOT* setLargest on the bounds |
// rect because we outset it for dst copy textures |
void setBounds(const SkRect& newBounds) { fBounds = newBounds; } |
@@ -110,6 +113,8 @@ 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 { |
@@ -148,6 +153,7 @@ protected: |
typedef InstancedHelper INHERITED; |
}; |
+ uint32_t fClassID; |
SkRect fBounds; |
private: |
@@ -166,11 +172,10 @@ private: |
enum { |
kIllegalBatchClassID = 0, |
}; |
+ SkAutoTUnref<const GrPipeline> fPipeline; |
static int32_t gCurrBatchClassID; |
- |
- SkDEBUGCODE(bool fUsed;) |
- |
int fNumberOfDraws; |
+ SkDEBUGCODE(bool fUsed;) |
typedef SkRefCnt INHERITED; |
}; |