Fix GrBufferAllocPool to include padding in bytes used for an allocation
Review URL: http://codereview.appspot.com/5784053/
git-svn-id: http://skia.googlecode.com/svn/trunk@3339 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index 8bed75f..70924f2 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -168,7 +168,8 @@
*offset = usedBytes;
*buffer = back.fBuffer;
back.fBytesFree -= size + pad;
- fBytesInUse += size;
+ fBytesInUse += size + pad;
+ VALIDATE();
return (void*)(reinterpret_cast<intptr_t>(fBufferPtr) + usedBytes);
}
}
@@ -335,6 +336,7 @@
GrAssert(!buffer->isLocked());
GrAssert(fCpuData.get() == fBufferPtr);
GrAssert(flushSize <= buffer->sizeInBytes());
+ VALIDATE(true);
if (fGpu->getCaps().fBufferLockSupport &&
flushSize > GR_GEOM_BUFFER_LOCK_THRESHOLD) {
@@ -346,6 +348,7 @@
}
}
buffer->updateData(fBufferPtr, flushSize);
+ VALIDATE(true);
}
GrGeometryBuffer* GrBufferAllocPool::createBuffer(size_t size) {