Reduce the API surface of GrBufferAllocPool and its derivatives
This utility class is going to be revamped and moved. This CL shrinks it a bit so there will be less to shuffle around.
Review URL: https://codereview.chromium.org/1126753003
diff --git a/src/gpu/GrBufferAllocPool.h b/src/gpu/GrBufferAllocPool.h
index 9ea33f7..df0a0cc 100644
--- a/src/gpu/GrBufferAllocPool.h
+++ b/src/gpu/GrBufferAllocPool.h
@@ -41,25 +41,10 @@
void reset();
/**
- * Gets the number of preallocated buffers that are yet to be used.
- */
- int preallocatedBuffersRemaining() const;
-
- /**
- * gets the number of preallocated buffers
- */
- int preallocatedBufferCount() const;
-
- /**
* Frees data from makeSpaces in LIFO order.
*/
void putBack(size_t bytes);
- /**
- * Gets the GrGpu that this pool is associated with.
- */
- GrGpu* getGpu() { return fGpu; }
-
protected:
/**
* Used to determine what type of buffers to create. We could make the
@@ -91,15 +76,6 @@
virtual ~GrBufferAllocPool();
/**
- * Gets the size of the preallocated buffers.
- *
- * @return the size of preallocated buffers.
- */
- size_t preallocatedBufferSize() const {
- return fPreallocBuffers.count() ? fMinBlockSize : 0;
- }
-
- /**
* Returns a block of memory to hold data. A buffer designated to hold the
* data is given to the caller. The buffer may or may not be locked. The
* returned ptr remains valid until any of the following:
@@ -123,25 +99,9 @@
const GrGeometryBuffer** buffer,
size_t* offset);
- /**
- * Gets the number of items of a size that can be added to the current
- * buffer without spilling to another buffer. If the pool has been reset, or
- * the previous makeSpace completely exhausted a buffer then the returned
- * size will be the size of the next available preallocated buffer, or zero
- * if no preallocated buffer remains available. It is assumed that items
- * should be itemSize-aligned from the start of a buffer.
- *
- * @return the number of items that would fit in the current buffer.
- */
- int currentBufferItems(size_t itemSize) const;
-
GrGeometryBuffer* createBuffer(size_t size);
private:
-
- // The GrGpu must be able to clear the ref of pools it creates as members
- friend class GrGpu;
-
struct BufferBlock {
size_t fBytesFree;
GrGeometryBuffer* fBuffer;
@@ -181,7 +141,7 @@
* Constructor
*
* @param gpu The GrGpu used to create the vertex buffers.
- * @param bufferSize The minimum size of created VBs This value
+ * @param bufferSize The minimum size of created VBs. This value
* will be clamped to some reasonable minimum.
* @param preallocBufferCnt The pool will allocate this number of VBs at
* bufferSize and keep them until it is
@@ -215,29 +175,6 @@
const GrVertexBuffer** buffer,
int* startVertex);
- /**
- * Gets the number of vertices that can be added to the current VB without
- * spilling to another VB. If the pool has been reset, or the previous
- * makeSpace completely exhausted a VB then the returned number of vertices
- * would fit in the next available preallocated buffer. If any makeSpace
- * would force a new VB to be created the return value will be zero.
- *
- * @param the size of a vertex to compute space for.
- * @return the number of vertices that would fit in the current buffer.
- */
- int currentBufferVertices(size_t vertexSize) const;
-
- /**
- * Gets the number of vertices that can fit in a preallocated vertex buffer.
- * Zero if no preallocated buffers.
- *
- * @param the size of a vertex to compute space for.
- *
- * @return number of vertices that fit in one of the preallocated vertex
- * buffers.
- */
- int preallocatedBufferVertices(size_t vertexSize) const;
-
private:
typedef GrBufferAllocPool INHERITED;
};
@@ -253,7 +190,7 @@
* Constructor
*
* @param gpu The GrGpu used to create the index buffers.
- * @param bufferSize The minimum size of created IBs This value
+ * @param bufferSize The minimum size of created IBs. This value
* will be clamped to some reasonable minimum.
* @param preallocBufferCnt The pool will allocate this number of VBs at
* bufferSize and keep them until it is
@@ -285,24 +222,6 @@
const GrIndexBuffer** buffer,
int* startIndex);
- /**
- * Gets the number of indices that can be added to the current IB without
- * spilling to another IB. If the pool has been reset, or the previous
- * makeSpace completely exhausted a IB then the returned number of indices
- * would fit in the next available preallocated buffer. If any makeSpace
- * would force a new IB to be created the return value will be zero.
- */
- int currentBufferIndices() const;
-
- /**
- * Gets the number of indices that can fit in a preallocated index buffer.
- * Zero if no preallocated buffers.
- *
- * @return number of indices that fit in one of the preallocated index
- * buffers.
- */
- int preallocatedBufferIndices() const;
-
private:
typedef GrBufferAllocPool INHERITED;
};