Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
GrEagerDynamicVertexAllocator Class Reference

#include <GrEagerVertexAllocator.h>

Inheritance diagram for GrEagerDynamicVertexAllocator:
GrEagerVertexAllocator

Public Member Functions

 GrEagerDynamicVertexAllocator (GrMeshDrawTarget *target, sk_sp< const GrBuffer > *vertexBuffer, int *baseVertex)
 
void * lock (size_t stride, int eagerCount) final
 
void unlock (int actualCount) final
 
- Public Member Functions inherited from GrEagerVertexAllocator
virtual void * lock (size_t stride, int eagerCount)=0
 
virtual void unlock (int actualCount)=0
 
virtual ~GrEagerVertexAllocator ()
 
skgpu::VertexWriter lockWriter (size_t stride, int eagerCount)
 

Detailed Description

Definition at line 41 of file GrEagerVertexAllocator.h.

Constructor & Destructor Documentation

◆ GrEagerDynamicVertexAllocator()

GrEagerDynamicVertexAllocator::GrEagerDynamicVertexAllocator ( GrMeshDrawTarget target,
sk_sp< const GrBuffer > *  vertexBuffer,
int baseVertex 
)
inline

Definition at line 43 of file GrEagerVertexAllocator.h.

46 : fTarget(target)
47 , fVertexBuffer(vertexBuffer)
48 , fBaseVertex(baseVertex) {
49 }
uint32_t * target

Member Function Documentation

◆ lock()

void * GrEagerDynamicVertexAllocator::lock ( size_t  stride,
int  eagerCount 
)
finalvirtual

Implements GrEagerVertexAllocator.

Definition at line 13 of file GrEagerVertexAllocator.cpp.

13 {
14 SkASSERT(!fLockCount);
15 SkASSERT(eagerCount);
16 if (void* data = fTarget->makeVertexSpace(stride, eagerCount, fVertexBuffer, fBaseVertex)) {
17 fLockStride = stride;
18 fLockCount = eagerCount;
19 return data;
20 }
21 fVertexBuffer->reset();
22 *fBaseVertex = 0;
23 return nullptr;
24}
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual void * makeVertexSpace(size_t vertexSize, int vertexCount, sk_sp< const GrBuffer > *, int *startVertex)=0
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ unlock()

void GrEagerDynamicVertexAllocator::unlock ( int  actualCount)
finalvirtual

Implements GrEagerVertexAllocator.

Definition at line 26 of file GrEagerVertexAllocator.cpp.

26 {
27 SkASSERT(fLockCount);
28 SkASSERT(actualCount <= fLockCount);
29 fTarget->putBackVertices(fLockCount - actualCount, fLockStride);
30 if (!actualCount) {
31 fVertexBuffer->reset();
32 *fBaseVertex = 0;
33 }
34 fLockCount = 0;
35}
virtual void putBackVertices(int vertices, size_t vertexStride)=0

The documentation for this class was generated from the following files: