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

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

Issue 1835283002: Simplify GrDrawBatch uploads and token uage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comments Created 4 years, 9 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
Index: src/gpu/batches/GrVertexBatch.h
diff --git a/src/gpu/batches/GrVertexBatch.h b/src/gpu/batches/GrVertexBatch.h
index 2af4dd1caddeb96abbf9d0d172471d1d954df72d..14e380933777ed775abf4b3b96533c4bfc4b5cb2 100644
--- a/src/gpu/batches/GrVertexBatch.h
+++ b/src/gpu/batches/GrVertexBatch.h
@@ -9,8 +9,8 @@
#define GrVertexBatch_DEFINED
#include "GrDrawBatch.h"
+#include "GrGeometryProcessor.h"
#include "GrMesh.h"
-#include "GrPrimitiveProcessor.h"
#include "GrPendingProgramElement.h"
#include "SkTLList.h"
@@ -39,7 +39,7 @@ protected:
int instancesToDraw);
/** Call after init() to issue draws to the batch target.*/
- void recordDraw(Target* target);
+ void recordDraw(Target* target, const GrGeometryProcessor*);
private:
GrMesh fMesh;
};
@@ -54,7 +54,7 @@ protected:
/** Finds the cached quad index buffer and reserves vertex space. Returns nullptr on failure
and on sucess a pointer to the vertex data that the caller should populate before
calling issueDraws(). */
- void* init(Target* batchTarget, size_t vertexStride, int quadsToDraw);
+ void* init(Target*, size_t vertexStride, int quadsToDraw);
using InstancedHelper::recordDraw;
private:
@@ -67,18 +67,21 @@ private:
virtual void onPrepareDraws(Target*) const = 0;
- // A set of contiguous draws with no inline uploads between them that all use the same
- // primitive processor. All the draws in a DrawArray share a primitive processor and use the
- // the batch's GrPipeline.
- struct DrawArray {
- SkSTArray<1, GrMesh, true> fDraws;
- GrPendingProgramElement<const GrPrimitiveProcessor> fPrimitiveProcessor;
+ // All draws in all the vertex batches have implicit tokens based on the order they are
+ // enqueued globally across all batches. This is the offset of the first entry in fQueuedDraws.
+ GrBatchDrawToken fBaseDrawToken;
+
+ // A set of contiguous draws that share a draw token and primitive processor. The draws all use
+ // the batch's pipeline. The reason for coallescing meshes that share a primitive processor
+ // is that it allows the Gpu object to setup the shared state once and then issue draws for
+ // each mesh.
+ struct QueuedDraw {
+ int fMeshCnt = 0;
+ GrPendingProgramElement<const GrGeometryProcessor> fGeometryProcessor;
};
- // Array of DrawArray. There may be inline uploads between each DrawArray and each DrawArray
- // may use a different primitive processor.
- typedef SkTLList<DrawArray, 4> DrawArrayList;
- DrawArrayList fDrawArrays;
+ SkSTArray<4, GrMesh> fMeshes;
+ SkSTArray<4, QueuedDraw, true> fQueuedDraws;
typedef GrDrawBatch INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698