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

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: comments updated 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..b7a0b1ece1a54f04394d7d553788a8cfaf897f38 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,9 +39,9 @@ protected:
int instancesToDraw);
/** Call after init() to issue draws to the batch target.*/
- void recordDraw(Target* target);
+ void recordDraw(Target*, const GrGeometryProcessor*);
private:
- GrMesh fMesh;
+ GrMesh fMesh;
};
static const int kVerticesPerQuad = 4;
@@ -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,23 @@ 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;
+ // A set of contiguous draws that share a draw token and primitive processor. The draws all use
+ // the batch's pipeline. The meshes for the draw are stored in the fMeshes array and each
robertphillips 2016/03/30 14:29:47 overlength
bsalomon 2016/03/30 16:59:11 Done.
+ // Queued draw uses fMeshCnt meshes from the fMeshes array. The reason for coallescing meshes that
robertphillips 2016/03/30 14:29:47 extra '.' ?
egdaniel 2016/03/30 15:52:33 if you're capitalizing Queued make it QueuedDraw
bsalomon 2016/03/30 16:59:11 Done.
bsalomon 2016/03/30 16:59:11 Done.
+ // share a primitive processor into a QueueDraw. 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;
+ // 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.
+ // fQueuedDraws[i]'s token is fBaseDrawToken + i.
+ GrBatchDrawToken fBaseDrawToken;
+
+ SkSTArray<4, GrMesh> fMeshes;
+ SkSTArray<4, QueuedDraw, true> fQueuedDraws;
typedef GrDrawBatch INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698