Change vertex buffer allocator functions to take size rather than layout, take two.
Resubmission of r7498.
https://codereview.appspot.com/7228078
git-svn-id: http://skia.googlecode.com/svn/trunk@7501 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 197cf0b..a0e3e99 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -592,7 +592,7 @@
}
void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(
- GrVertexLayout vertexLayout,
+ size_t vertexSize,
int vertexCount,
int indexCount) {
if (NULL != fAutoFlushTarget) {
@@ -624,14 +624,14 @@
!unreleasedVertexSpace &&
!unreleasedIndexSpace &&
!targetHasReservedGeom &&
- this->geometryHints(vertexLayout, &vcount, &icount)) {
+ this->geometryHints(vertexSize, &vcount, &icount)) {
this->flushTo(fAutoFlushTarget);
}
}
}
-bool GrInOrderDrawBuffer::geometryHints(GrVertexLayout vertexLayout,
+bool GrInOrderDrawBuffer::geometryHints(size_t vertexSize,
int* vertexCount,
int* indexCount) const {
// we will recommend a flush if the data could fit in a single
@@ -649,10 +649,10 @@
*indexCount = currIndices;
}
if (NULL != vertexCount) {
- int32_t currVertices = fVertexPool.currentBufferVertices(vertexLayout);
+ int32_t currVertices = fVertexPool.currentBufferVertices(vertexSize);
if (*vertexCount > currVertices &&
(!fVertexPool.preallocatedBuffersRemaining() &&
- *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexLayout))) {
+ *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexSize))) {
flush = true;
}
@@ -661,7 +661,7 @@
return flush;
}
-bool GrInOrderDrawBuffer::onReserveVertexSpace(GrVertexLayout vertexLayout,
+bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize,
int vertexCount,
void** vertices) {
GeometryPoolState& poolState = fGeoPoolStateStack.back();
@@ -669,7 +669,7 @@
GrAssert(NULL != vertices);
GrAssert(0 == poolState.fUsedPoolVertexBytes);
- *vertices = fVertexPool.makeSpace(vertexLayout,
+ *vertices = fVertexPool.makeSpace(vertexSize,
vertexCount,
&poolState.fPoolVertexBuffer,
&poolState.fPoolStartVertex);
@@ -736,7 +736,7 @@
#if GR_DEBUG
bool success =
#endif
- fVertexPool.appendVertices(this->getVertexLayout(),
+ fVertexPool.appendVertices(GrDrawState::VertexSize(this->getVertexLayout()),
vertexCount,
vertexArray,
&poolState.fPoolVertexBuffer,