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

Unified Diff: src/gpu/batches/GrBatch.h

Issue 1278643006: Make GrBatch carry its own GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 4 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 | « src/gpu/GrTargetCommands.cpp ('k') | src/gpu/batches/GrBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrBatch.h
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h
index 7d91b1c1e18031bfa20091ea14c23dfb0da40f31..815369124a3e71a47a109e8c5a5404782575d42e 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -47,14 +47,8 @@ struct GrInitInvariantOutput;
class GrBatch : public GrNonAtomicRef {
public:
- GrBatch()
- : fClassID(kIllegalBatchID)
- , fNumberOfDraws(0)
-#if GR_BATCH_SPEW
- , fUniqueID(GenID(&gCurrBatchUniqueID))
-#endif
- { SkDEBUGCODE(fUsed = false;) }
- virtual ~GrBatch() {}
+ GrBatch();
+ ~GrBatch() override;
virtual const char* name() const = 0;
virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
@@ -101,13 +95,13 @@ public:
SkDEBUGCODE(bool isUsed() const { return fUsed; })
- const GrPipeline* pipeline() const { return fPipeline; }
-
- void setPipeline(const GrPipeline* pipeline, const GrPipelineOptimizations& optimizations) {
- fPipeline.reset(SkRef(pipeline));
- this->initBatchTracker(optimizations);
+ const GrPipeline* pipeline() const {
+ SkASSERT(fPipelineInstalled);
+ return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get());
}
+ bool installPipeline(const GrPipeline::CreateArgs&);
+
#if GR_BATCH_SPEW
uint32_t uniqueID() const { return fUniqueID; }
#endif
@@ -190,15 +184,15 @@ private:
enum {
kIllegalBatchID = 0,
};
- SkAutoTUnref<const GrPipeline> fPipeline;
- static int32_t gCurrBatchClassID;
- int fNumberOfDraws;
- SkDEBUGCODE(bool fUsed;)
+ SkAlignedSTStorage<1, GrPipeline> fPipelineStorage;
+ int fNumberOfDraws;
+ SkDEBUGCODE(bool fUsed;)
+ bool fPipelineInstalled;
#if GR_BATCH_SPEW
+ uint32_t fUniqueID;
static int32_t gCurrBatchUniqueID;
- uint32_t fUniqueID;
#endif
-
+ static int32_t gCurrBatchClassID;
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « src/gpu/GrTargetCommands.cpp ('k') | src/gpu/batches/GrBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698