Index: src/gpu/GrBatchTarget.cpp |
diff --git a/src/gpu/GrBatchTarget.cpp b/src/gpu/GrBatchTarget.cpp |
index b6dadd699ba994201000db13f7425c44cbff7c6d..31b4cc9f47f15ab287e5be8e65d29b8816ea0ff6 100644 |
--- a/src/gpu/GrBatchTarget.cpp |
+++ b/src/gpu/GrBatchTarget.cpp |
@@ -10,16 +10,27 @@ |
#include "GrBatchAtlas.h" |
#include "GrPipeline.h" |
+static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15; |
+static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4; |
+ |
+static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 1 << 11; |
+static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4; |
+ |
GrBatchTarget::GrBatchTarget(GrGpu* gpu) |
: fGpu(gpu) |
- , fVertexPool(gpu) |
- , fIndexPool(gpu) |
, fFlushBuffer(kFlushBufferInitialSizeInBytes) |
, fIter(fFlushBuffer) |
, fNumberOfDraws(0) |
, fCurrentToken(0) |
, fLastFlushedToken(0) |
, fInlineUpdatesIndex(0) { |
+ |
+ fVertexPool.reset(SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu, |
+ DRAW_BUFFER_VBPOOL_BUFFER_SIZE, |
+ DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS))); |
+ fIndexPool.reset(SkNEW_ARGS(GrIndexBufferAllocPool, (fGpu, |
+ DRAW_BUFFER_IBPOOL_BUFFER_SIZE, |
+ DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS))); |
} |
void GrBatchTarget::flushNext(int n) { |
@@ -54,11 +65,11 @@ |
void* GrBatchTarget::makeVertSpace(size_t vertexSize, int vertexCount, |
const GrVertexBuffer** buffer, int* startVertex) { |
- return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex); |
+ return fVertexPool->makeSpace(vertexSize, vertexCount, buffer, startVertex); |
} |
uint16_t* GrBatchTarget::makeIndexSpace(int indexCount, |
const GrIndexBuffer** buffer, int* startIndex) { |
- return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex)); |
+ return reinterpret_cast<uint16_t*>(fIndexPool->makeSpace(indexCount, buffer, startIndex)); |
} |