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

Unified Diff: src/gpu/GrBatch.h

Issue 1237283007: Give GrBatch a pointer to GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 5 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 | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrInOrderCommandBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrInOrderCommandBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698