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

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

Issue 1897203002: Implement instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_requireHWAA
Patch Set: comments Created 4 years, 8 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/GrInstancedRenderingTypes.h ('k') | src/gpu/effects/GrInstanceProcessor.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 f0559330feb82db2764b1e444858d0d08ba3b13c..4e38b61775094a1162b077c1e6479914c79f5e92 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -141,6 +141,9 @@ private:
virtual void onPrepare(GrBatchFlushState*) = 0;
virtual void onDraw(GrBatchFlushState*) = 0;
+ // Override this method if the batch subclass gets allocated in a nonstandard way.
+ virtual void onDelete() const { delete this; }
+
static uint32_t GenID(int32_t* idCounter) {
// The atomic inc returns the old value not the incremented value. So we add
// 1 to the returned value.
@@ -162,6 +165,12 @@ private:
mutable uint32_t fUniqueID;
static int32_t gCurrBatchUniqueID;
static int32_t gCurrBatchClassID;
+
+ friend void GrTDeleteNonAtomicRef(const GrBatch*); // For onDelete.
};
+inline void GrTDeleteNonAtomicRef(const GrBatch* batch) {
+ batch->onDelete();
+}
+
#endif
« no previous file with comments | « src/gpu/GrInstancedRenderingTypes.h ('k') | src/gpu/effects/GrInstanceProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698