#ifndef GrBatchBuffer_DEFINED
#define GrBatchBuffer_DEFINED
+#include "GrBufferAllocPool.h"
#include "GrPendingProgramElement.h"
#include "GrPipeline.h"
#include "GrGpu.h"
const GrIndexBuffer* quadIndexBuffer() const { return fGpu->getQuadIndexBuffer(); }
+ // A helper for draws which overallocate and then return data to the pool
+ void putBackIndices(size_t indices) { fIndexPool->putBack(indices * sizeof(uint16_t)); }
+
+ void putBackVertices(size_t vertices, size_t vertexStride) {
+ fVertexPool->putBack(vertices * vertexStride);
+ }
+
private:
GrGpu* fGpu;
GrVertexBufferAllocPool* fVertexPool;
drawInfo.setIndexCount(0);
}
batchTarget->draw(drawInfo);
+
+ // put back reserves
+ batchTarget->putBackIndices((size_t)(maxIndices - indexOffset));
+ batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)vertexStride);
}
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }