From 7a5af8b7dc946ccb94fdc22491623a8bfafc88fa Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Fri, 18 Feb 2011 18:40:42 +0000 Subject: [PATCH] Avoid putting adding vertex buffers to the pool when setting the complex clip. Review URL: http://codereview.appspot.com/4180058/ git-svn-id: http://skia.googlecode.com/svn/trunk@817 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/src/GrGpu.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp index 57d313ce1..9e9c1859c 100644 --- a/gpu/src/GrGpu.cpp +++ b/gpu/src/GrGpu.cpp @@ -24,7 +24,8 @@ #include "GrBufferAllocPool.h" // probably makes no sense for this to be less than a page -static size_t VERTEX_POOL_VB_SIZE = 1 << 12; +static const size_t VERTEX_POOL_VB_SIZE = 1 << 12; +static const int VERTEX_POOL_VB_COUNT = 1; /////////////////////////////////////////////////////////////////////////////// @@ -197,7 +198,11 @@ bool GrGpu::setupClipAndFlushState(PrimitiveType type) { fVertexPool = new GrVertexBufferAllocPool(this, true, VERTEX_POOL_VB_SIZE, - 1); + VERTEX_POOL_VB_COUNT); + } else if (kBuffer_GeometrySrcType == fGeometrySrc.fVertexSrc) { + // we can't reset if vertex source is array or reserved + // because then the client data is in the pool! + fVertexPool->reset(); } const GrVertexBuffer* vertexBuffer; int vStart; @@ -309,7 +314,9 @@ void GrGpu::finalizeReservedIndices() { void GrGpu::prepareVertexPool() { if (NULL == fVertexPool) { - fVertexPool = new GrVertexBufferAllocPool(this, true, VERTEX_POOL_VB_SIZE, 1); + fVertexPool = new GrVertexBufferAllocPool(this, true, + VERTEX_POOL_VB_SIZE, + VERTEX_POOL_VB_COUNT); } else { fVertexPool->reset(); }