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

Unified Diff: src/gpu/GrBatchTarget.cpp

Issue 1131553002: Isolate GrBufferAllocPools inside GrBatchTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 7 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
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrBufferAllocPool.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBatchTarget.cpp
diff --git a/src/gpu/GrBatchTarget.cpp b/src/gpu/GrBatchTarget.cpp
index b5293d70c576e9771a10165597d4658f1e1c05ef..31b4cc9f47f15ab287e5be8e65d29b8816ea0ff6 100644
--- a/src/gpu/GrBatchTarget.cpp
+++ b/src/gpu/GrBatchTarget.cpp
@@ -10,18 +10,27 @@
#include "GrBatchAtlas.h"
#include "GrPipeline.h"
-GrBatchTarget::GrBatchTarget(GrGpu* gpu,
- GrVertexBufferAllocPool* vpool,
- GrIndexBufferAllocPool* ipool)
+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(vpool)
- , fIndexPool(ipool)
, 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) {
@@ -53,3 +62,14 @@ void GrBatchTarget::flushNext(int n) {
}
}
}
+
+void* GrBatchTarget::makeVertSpace(size_t vertexSize, int vertexCount,
+ const GrVertexBuffer** buffer, int* 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));
+}
+
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrBufferAllocPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698