aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-02-24 13:20:59 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-24 13:20:59 -0800
commit6065b88d1cb17ec2bfefbb34378acf6337f233a1 (patch)
treead32544562a24010198323175a08bda4c623badb
parent4739955e98ba86900a5bbac0e3661601427a54d4 (diff)
fix for msan
-rw-r--r--src/gpu/GrBatchTarget.cpp1
-rw-r--r--src/gpu/GrBatchTarget.h8
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp4
3 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/GrBatchTarget.cpp b/src/gpu/GrBatchTarget.cpp
index 7a2d14e923..21658d2a01 100644
--- a/src/gpu/GrBatchTarget.cpp
+++ b/src/gpu/GrBatchTarget.cpp
@@ -7,7 +7,6 @@
#include "GrBatchTarget.h"
-#include "GrBufferAllocPool.h"
#include "GrPipeline.h"
/*
diff --git a/src/gpu/GrBatchTarget.h b/src/gpu/GrBatchTarget.h
index 51dd8cac89..ae046c1ee1 100644
--- a/src/gpu/GrBatchTarget.h
+++ b/src/gpu/GrBatchTarget.h
@@ -8,6 +8,7 @@
#ifndef GrBatchBuffer_DEFINED
#define GrBatchBuffer_DEFINED
+#include "GrBufferAllocPool.h"
#include "GrPendingProgramElement.h"
#include "GrPipeline.h"
#include "GrGpu.h"
@@ -82,6 +83,13 @@ public:
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;
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 131b518296..302aad7795 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -372,6 +372,10 @@ public:
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; }