Flutter Engine
The Flutter Engine
|
#include <GrBufferAllocPool.h>
Public Member Functions | |
GrIndexBufferAllocPool (GrGpu *gpu, sk_sp< CpuBufferCache > cpuBufferCache) | |
void * | makeSpace (int indexCount, sk_sp< const GrBuffer > *buffer, int *startIndex) |
void * | makeSpaceAtLeast (int minIndexCount, int fallbackIndexCount, sk_sp< const GrBuffer > *buffer, int *startIndex, int *actualIndexCount) |
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 index buffers
Definition at line 256 of file GrBufferAllocPool.h.
GrIndexBufferAllocPool::GrIndexBufferAllocPool | ( | GrGpu * | gpu, |
sk_sp< CpuBufferCache > | cpuBufferCache | ||
) |
Constructor
gpu | The GrGpu used to create the index 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 484 of file GrBufferAllocPool.cpp.
void * GrIndexBufferAllocPool::makeSpace | ( | int | indexCount, |
sk_sp< const GrBuffer > * | buffer, | ||
int * | startIndex | ||
) |
Returns a block of memory to hold indices. A buffer designated to hold the indices is 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 indices are guaranteed to be in the buffer at the offset indicated by startIndex. Until that time they may be in temporary storage and/or the buffer may be locked.
indexCount | number of indices to allocate space for |
buffer | returns the index buffer that will hold the indices. |
startIndex | returns the offset into buffer of the first index. |
Definition at line 487 of file GrBufferAllocPool.cpp.
void * GrIndexBufferAllocPool::makeSpaceAtLeast | ( | int | minIndexCount, |
int | fallbackIndexCount, | ||
sk_sp< const GrBuffer > * | buffer, | ||
int * | startIndex, | ||
int * | actualIndexCount | ||
) |
Returns a block of memory to hold indices. A buffer designated to hold the indices is 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 indices are guaranteed to be in the buffer at the offset indicated by startIndex. Until that time they may be in temporary storage and/or the buffer may be locked.
The caller requests a minimum number of indices, but the block may be (much) larger. Assuming that a new block must be allocated, it will be sized to hold fallbackIndexCount indices. The actual block size (in indices) is returned in actualIndexCount.
minIndexCount | minimum number of indices to allocate space for |
fallbackIndexCount | number of indices to allocate space for if a new block is needed |
buffer | returns the index buffer that will hold the indices. |
startIndex | returns the offset into buffer of the first index. |
actualIndexCount | returns the capacity of the block (in indices) |
Definition at line 504 of file GrBufferAllocPool.cpp.