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

#include <GrVertexChunkArray.h>

Inheritance diagram for GrVertexChunkBuilder:
SkNoncopyable

Public Member Functions

 GrVertexChunkBuilder (GrMeshDrawTarget *target, GrVertexChunkArray *chunks, size_t stride, int minVerticesPerChunk)
 
 ~GrVertexChunkBuilder ()
 
size_t stride () const
 
SK_ALWAYS_INLINE skgpu::VertexWriter appendVertices (int count)
 
void popVertices (int count)
 

Detailed Description

Definition at line 41 of file GrVertexChunkArray.h.

Constructor & Destructor Documentation

◆ GrVertexChunkBuilder()

GrVertexChunkBuilder::GrVertexChunkBuilder ( GrMeshDrawTarget target,
GrVertexChunkArray chunks,
size_t  stride,
int  minVerticesPerChunk 
)
inline

Definition at line 43 of file GrVertexChunkArray.h.

45 : fTarget(target)
46 , fChunks(chunks)
47 , fStride(stride)
48 , fMinVerticesPerChunk(minVerticesPerChunk) {
49 SkASSERT(fMinVerticesPerChunk > 0);
50 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
uint32_t * target

◆ ~GrVertexChunkBuilder()

GrVertexChunkBuilder::~GrVertexChunkBuilder ( )

Definition at line 12 of file GrVertexChunkArray.cpp.

12 {
13 if (!fChunks->empty()) {
14 fTarget->putBackVertices(fCurrChunkVertexCapacity - fCurrChunkVertexCount, fStride);
15 fChunks->back().fCount = fCurrChunkVertexCount;
16 }
17}
virtual void putBackVertices(int vertices, size_t vertexStride)=0
bool empty() const
Definition: SkTArray.h:199

Member Function Documentation

◆ appendVertices()

SK_ALWAYS_INLINE skgpu::VertexWriter GrVertexChunkBuilder::appendVertices ( int  count)
inline

Definition at line 58 of file GrVertexChunkArray.h.

58 {
59 SkASSERT(count > 0);
60 if (fCurrChunkVertexCount + count > fCurrChunkVertexCapacity && !this->allocChunk(count)) {
61 SkDEBUGCODE(fLastAppendAmount = 0;)
62 return {};
63 }
64 SkASSERT(fCurrChunkVertexCount + count <= fCurrChunkVertexCapacity);
65 fCurrChunkVertexCount += count;
66 SkDEBUGCODE(fLastAppendAmount = count;)
67 return std::exchange(fCurrChunkVertexWriter,
68 fCurrChunkVertexWriter.makeOffset(fStride * count));
69 }
int count
Definition: FontMgrTest.cpp:50
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
VertexWriter makeOffset(size_t offsetInBytes) const
Definition: BufferWriter.h:142

◆ popVertices()

void GrVertexChunkBuilder::popVertices ( int  count)
inline

Definition at line 73 of file GrVertexChunkArray.h.

73 {
74 SkASSERT(count <= fLastAppendAmount);
75 SkASSERT(fLastAppendAmount <= fCurrChunkVertexCount);
76 SkASSERT(count >= 0);
77 fCurrChunkVertexCount -= count;
78 fCurrChunkVertexWriter = fCurrChunkVertexWriter.makeOffset(fStride * -count);
79 SkDEBUGCODE(fLastAppendAmount -= count;)
80 }

◆ stride()

size_t GrVertexChunkBuilder::stride ( ) const
inline

Definition at line 54 of file GrVertexChunkArray.h.

54{ return fStride; }

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