| Index: src/gpu/GrBufferAllocPool.h
|
| diff --git a/src/gpu/GrBufferAllocPool.h b/src/gpu/GrBufferAllocPool.h
|
| index 071b00b064afba135a1b536911146df1f0027d58..a3d8e45364295cc0e55f58684373ee0e61b76e9b 100644
|
| --- a/src/gpu/GrBufferAllocPool.h
|
| +++ b/src/gpu/GrBufferAllocPool.h
|
| @@ -11,9 +11,8 @@
|
| #include "SkTArray.h"
|
| #include "SkTDArray.h"
|
| #include "SkTypes.h"
|
| -#include "GrTypesPriv.h"
|
| -
|
| -class GrBuffer;
|
| +
|
| +class GrGeometryBuffer;
|
| class GrGpu;
|
|
|
| /**
|
| @@ -48,6 +47,16 @@
|
|
|
| protected:
|
| /**
|
| + * Used to determine what type of buffers to create. We could make the
|
| + * createBuffer a virtual except that we want to use it in the cons for
|
| + * pre-allocated buffers.
|
| + */
|
| + enum BufferType {
|
| + kVertex_BufferType,
|
| + kIndex_BufferType,
|
| + };
|
| +
|
| + /**
|
| * Constructor
|
| *
|
| * @param gpu The GrGpu used to create the buffers.
|
| @@ -57,7 +66,7 @@
|
| * reasonable minimum.
|
| */
|
| GrBufferAllocPool(GrGpu* gpu,
|
| - GrBufferType bufferType,
|
| + BufferType bufferType,
|
| size_t bufferSize = 0);
|
|
|
| virtual ~GrBufferAllocPool();
|
| @@ -83,15 +92,15 @@
|
| */
|
| void* makeSpace(size_t size,
|
| size_t alignment,
|
| - const GrBuffer** buffer,
|
| + const GrGeometryBuffer** buffer,
|
| size_t* offset);
|
|
|
| - GrBuffer* getBuffer(size_t size);
|
| + GrGeometryBuffer* getBuffer(size_t size);
|
|
|
| private:
|
| struct BufferBlock {
|
| - size_t fBytesFree;
|
| - GrBuffer* fBuffer;
|
| + size_t fBytesFree;
|
| + GrGeometryBuffer* fBuffer;
|
| };
|
|
|
| bool createBlock(size_t requestSize);
|
| @@ -106,13 +115,15 @@
|
|
|
| GrGpu* fGpu;
|
| size_t fMinBlockSize;
|
| - GrBufferType fBufferType;
|
| + BufferType fBufferType;
|
|
|
| SkTArray<BufferBlock> fBlocks;
|
| void* fCpuData;
|
| void* fBufferPtr;
|
| - size_t fBufferMapThreshold;
|
| + size_t fGeometryBufferMapThreshold;
|
| };
|
| +
|
| +class GrVertexBuffer;
|
|
|
| /**
|
| * A GrBufferAllocPool of vertex buffers
|
| @@ -149,12 +160,14 @@
|
| */
|
| void* makeSpace(size_t vertexSize,
|
| int vertexCount,
|
| - const GrBuffer** buffer,
|
| + const GrVertexBuffer** buffer,
|
| int* startVertex);
|
|
|
| private:
|
| typedef GrBufferAllocPool INHERITED;
|
| };
|
| +
|
| +class GrIndexBuffer;
|
|
|
| /**
|
| * A GrBufferAllocPool of index buffers
|
| @@ -187,7 +200,7 @@
|
| * @return pointer to first index.
|
| */
|
| void* makeSpace(int indexCount,
|
| - const GrBuffer** buffer,
|
| + const GrIndexBuffer** buffer,
|
| int* startIndex);
|
|
|
| private:
|
|
|