| Index: src/gpu/batches/GrVertexBatch.h
|
| diff --git a/src/gpu/batches/GrVertexBatch.h b/src/gpu/batches/GrVertexBatch.h
|
| index 882cfa0c8ddda977120f02afc8e36fa0bb04e1bf..b868962411a7fd32e73df3fecfa8f0e34f605ef5 100644
|
| --- a/src/gpu/batches/GrVertexBatch.h
|
| +++ b/src/gpu/batches/GrVertexBatch.h
|
| @@ -9,20 +9,25 @@
|
| #define GrVertexBatch_DEFINED
|
|
|
| #include "GrDrawBatch.h"
|
| -#include "GrBatchTarget.h"
|
| +#include "GrPrimitiveProcessor.h"
|
| +#include "GrPendingProgramElement.h"
|
| +#include "GrVertices.h"
|
| +
|
| +#include "SkTLList.h"
|
| +
|
| +class GrBatchFlushState;
|
|
|
| /**
|
| * Base class for vertex-based GrBatches.
|
| */
|
| class GrVertexBatch : public GrDrawBatch {
|
| public:
|
| - GrVertexBatch();
|
| + class Target;
|
|
|
| - virtual void generateGeometry(GrBatchTarget*) = 0;
|
| + GrVertexBatch();
|
|
|
| - // TODO this goes away when batches are everywhere
|
| - void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; }
|
| - int numberOfDraws() const { return fNumberOfDraws; }
|
| + void prepareDraws(GrBatchFlushState* state);
|
| + void issueDraws(GrBatchFlushState* state);
|
|
|
| protected:
|
| /** Helper for rendering instances using an instanced index index buffer. This class creates the
|
| @@ -32,15 +37,12 @@ protected:
|
| InstancedHelper() {}
|
| /** Returns the allocated storage for the vertices. The caller should populate the before
|
| vertices before calling issueDraws(). */
|
| - void* init(GrBatchTarget* batchTarget, GrPrimitiveType, size_t vertexStride,
|
| + void* init(Target*, GrPrimitiveType, size_t vertexStride,
|
| const GrIndexBuffer*, int verticesPerInstance, int indicesPerInstance,
|
| int instancesToDraw);
|
|
|
| /** Call after init() to issue draws to the batch target.*/
|
| - void issueDraw(GrBatchTarget* batchTarget) {
|
| - SkASSERT(fVertices.instanceCount());
|
| - batchTarget->draw(fVertices);
|
| - }
|
| + void recordDraw(Target* target);
|
| private:
|
| GrVertices fVertices;
|
| };
|
| @@ -55,16 +57,31 @@ protected:
|
| /** Finds the cached quad index buffer and reserves vertex space. Returns NULL on failure
|
| and on sucess a pointer to the vertex data that the caller should populate before
|
| calling issueDraws(). */
|
| - void* init(GrBatchTarget* batchTarget, size_t vertexStride, int quadsToDraw);
|
| -
|
| - using InstancedHelper::issueDraw;
|
| + void* init(Target* batchTarget, size_t vertexStride, int quadsToDraw);
|
|
|
| + using InstancedHelper::recordDraw;
|
| private:
|
| typedef InstancedHelper INHERITED;
|
| };
|
|
|
| private:
|
| - int fNumberOfDraws;
|
| + virtual void onPrepareDraws(Target*) = 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, GrVertices, true> fDraws;
|
| + GrPendingProgramElement<const GrPrimitiveProcessor> fPrimitiveProcessor;
|
| + };
|
| +
|
| + // Array of DrawArray. There may be inline uploads between each DrawArray and each DrawArray
|
| + // may use a different primitive processor.
|
| + SkTLList<DrawArray> fDrawArrays;
|
| +
|
| + // What is this?
|
| + GrBatchTracker fBatchTracker;
|
| +
|
| typedef GrDrawBatch INHERITED;
|
| };
|
|
|
|
|