Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GrCpuVertexAllocator Class Reference

#include <GrEagerVertexAllocator.h>

Inheritance diagram for GrCpuVertexAllocator:
GrEagerVertexAllocator

Public Member Functions

 GrCpuVertexAllocator ()=default
 
void * lock (size_t stride, int eagerCount) override
 
void unlock (int actualCount) override
 
sk_sp< GrThreadSafeCache::VertexDatadetachVertexData ()
 
- Public Member Functions inherited from GrEagerVertexAllocator
virtual ~GrEagerVertexAllocator ()
 
skgpu::VertexWriter lockWriter (size_t stride, int eagerCount)
 

Detailed Description

Definition at line 72 of file GrEagerVertexAllocator.h.

Constructor & Destructor Documentation

◆ GrCpuVertexAllocator()

GrCpuVertexAllocator::GrCpuVertexAllocator ( )
default

Member Function Documentation

◆ detachVertexData()

sk_sp< GrThreadSafeCache::VertexData > GrCpuVertexAllocator::detachVertexData ( )

Definition at line 59 of file GrEagerVertexAllocator.cpp.

59 {
60 SkASSERT(!fLockStride && !fVertices && fVertexData);
61
62 return std::move(fVertexData);
63}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ lock()

void * GrCpuVertexAllocator::lock ( size_t  stride,
int  eagerCount 
)
overridevirtual

Implements GrEagerVertexAllocator.

Definition at line 38 of file GrEagerVertexAllocator.cpp.

38 {
39 SkASSERT(!fLockStride && !fVertices && !fVertexData);
40 SkASSERT(stride && eagerCount);
41
42 fVertices = sk_malloc_throw(eagerCount * stride);
43 fLockStride = stride;
44
45 return fVertices;
46}
static void * sk_malloc_throw(size_t size)
Definition SkMalloc.h:67

◆ unlock()

void GrCpuVertexAllocator::unlock ( int  actualCount)
overridevirtual

Implements GrEagerVertexAllocator.

Definition at line 48 of file GrEagerVertexAllocator.cpp.

48 {
49 SkASSERT(fLockStride && fVertices && !fVertexData);
50
51 fVertices = sk_realloc_throw(fVertices, actualCount * fLockStride);
52
53 fVertexData = GrThreadSafeCache::MakeVertexData(fVertices, actualCount, fLockStride);
54
55 fVertices = nullptr;
56 fLockStride = 0;
57}
SK_API void * sk_realloc_throw(void *buffer, size_t size)
static sk_sp< VertexData > MakeVertexData(const void *vertices, int vertexCount, size_t vertexSize)

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