Flutter Engine
The Flutter Engine
|
#include <GrBufferAllocPool.h>
Public Member Functions | |
GrVertexBufferAllocPool (GrGpu *gpu, sk_sp< CpuBufferCache > cpuBufferCache) | |
void * | makeSpace (size_t vertexSize, int vertexCount, sk_sp< const GrBuffer > *buffer, int *startVertex) |
void * | makeSpaceAtLeast (size_t vertexSize, int minVertexCount, int fallbackVertexCount, sk_sp< const GrBuffer > *buffer, int *startVertex, int *actualVertexCount) |
Public Member Functions inherited from GrBufferAllocPool | |
void | unmap () |
void | reset () |
void | putBack (size_t bytes) |
Additional Inherited Members | |
Static Public Attributes inherited from GrBufferAllocPool | |
static constexpr size_t | kDefaultBufferSize = 1 << 15 |
Protected Member Functions inherited from GrBufferAllocPool | |
GrBufferAllocPool (GrGpu *gpu, GrGpuBufferType bufferType, sk_sp< CpuBufferCache > cpuBufferCache) | |
virtual | ~GrBufferAllocPool () |
void * | makeSpace (size_t size, size_t alignment, sk_sp< const GrBuffer > *buffer, size_t *offset) |
void * | makeSpaceAtLeast (size_t minSize, size_t fallbackSize, size_t alignment, sk_sp< const GrBuffer > *buffer, size_t *offset, size_t *actualSize) |
sk_sp< GrBuffer > | getBuffer (size_t size) |
A GrBufferAllocPool of vertex buffers
Definition at line 177 of file GrBufferAllocPool.h.
GrVertexBufferAllocPool::GrVertexBufferAllocPool | ( | GrGpu * | gpu, |
sk_sp< CpuBufferCache > | cpuBufferCache | ||
) |
Constructor
gpu | The GrGpu used to create the vertex buffers. |
cpuBufferCache | If non-null a cache for client side array buffers or staging buffers used before data is uploaded to GPU buffer objects. |
Definition at line 431 of file GrBufferAllocPool.cpp.
void * GrVertexBufferAllocPool::makeSpace | ( | size_t | vertexSize, |
int | vertexCount, | ||
sk_sp< const GrBuffer > * | buffer, | ||
int * | startVertex | ||
) |
Returns a block of memory to hold vertices. A buffer designated to hold the vertices given to the caller. The buffer may or may not be locked. The returned ptr remains valid until any of the following: *makeSpace is called again. *unmap is called. *reset is called. *this object is destroyed.
Once unmap on the pool is called the vertices are guaranteed to be in the buffer at the offset indicated by startVertex. Until that time they may be in temporary storage and/or the buffer may be locked.
vertexSize | specifies size of a vertex to allocate space for |
vertexCount | number of vertices to allocate space for |
buffer | returns the vertex buffer that will hold the vertices. |
startVertex | returns the offset into buffer of the first vertex. In units of the size of a vertex from layout param. |
Definition at line 434 of file GrBufferAllocPool.cpp.
void * GrVertexBufferAllocPool::makeSpaceAtLeast | ( | size_t | vertexSize, |
int | minVertexCount, | ||
int | fallbackVertexCount, | ||
sk_sp< const GrBuffer > * | buffer, | ||
int * | startVertex, | ||
int * | actualVertexCount | ||
) |
Returns a block of memory to hold vertices. A buffer designated to hold the vertices given to the caller. The buffer may or may not be locked. The returned ptr remains valid until any of the following: *makeSpace is called again. *unmap is called. *reset is called. *this object is destroyed.
Once unmap on the pool is called the vertices are guaranteed to be in the buffer at the offset indicated by startVertex. Until that time they may be in temporary storage and/or the buffer may be locked.
The caller requests a minimum number of vertices, but the block may be (much) larger. Assuming that a new block must be allocated, it will be sized to hold fallbackVertexCount vertices. The actual block size (in vertices) is returned in actualVertexCount.
vertexSize | specifies size of a vertex to allocate space for |
minVertexCount | minimum number of vertices to allocate space for |
fallbackVertexCount | number of vertices to allocate space for if a new block is needed |
buffer | returns the vertex buffer that will hold the vertices. |
startVertex | returns the offset into buffer of the first vertex. In units of the size of a vertex from layout param. |
actualVertexCount | returns the capacity of the block (in vertices) |
Definition at line 453 of file GrBufferAllocPool.cpp.