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

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

Issue 1293563003: Put clear and discard into GrBatch. (Closed) Base URL: https://skia.googlesource.com/skia.git@protectedprepare
Patch Set: tiny 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/GrClearBatch.h » ('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 7bb6af1265361bba946f8e88d561cdd0c6605167..b6eec1f969ea1e25de8eb4c86946882a8efa2ba4 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -12,8 +12,10 @@
#include "GrNonAtomicRef.h"
#include "SkRect.h"
+#include "SkString.h"
class GrCaps;
+class GrBatchFlushState;
/**
* GrBatch is the base class for all Ganesh deferred geometry generators. To facilitate
@@ -79,6 +81,20 @@ public:
#endif
SkDEBUGCODE(bool isUsed() const { return fUsed; })
+ /** Called prior to drawing. The batch should perform any resource creation necessary to
+ to quickly issue its draw when draw is called. */
+ void prepare(GrBatchFlushState* state) { this->onPrepare(state); }
+
+ /** Issues the batches commands to GrGpu. */
+ void draw(GrBatchFlushState* state) { this->onDraw(state); }
+
+ /** Used to block batching across render target changes. Remove this once we store
+ GrBatches for different RTs in different targets. */
+ virtual uint32_t renderTargetUniqueID() const = 0;
+
+ /** Used for spewing information about batches when debugging. */
+ virtual SkString dumpInfo() const = 0;
+
protected:
template <typename PROC_SUBCLASS> void initClassID() {
static uint32_t kClassID = GenID(&gCurrBatchClassID);
@@ -98,6 +114,9 @@ protected:
private:
virtual bool onCombineIfPossible(GrBatch*, const GrCaps& caps) = 0;
+ virtual void onPrepare(GrBatchFlushState*) = 0;
+ virtual void onDraw(GrBatchFlushState*) = 0;
+
static uint32_t GenID(int32_t* idCounter) {
// fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
// atomic inc returns the old value not the incremented value. So we add
« no previous file with comments | « src/gpu/GrTargetCommands.cpp ('k') | src/gpu/batches/GrClearBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698