Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
skgpu::VertexWriter Struct Reference

#include <BufferWriter.h>

Inheritance diagram for skgpu::VertexWriter:
skgpu::BufferWriter

Classes

struct  ArrayDesc
 
struct  Conditional
 
struct  is_quad
 
struct  is_quad< GrQuad >
 
struct  is_quad< VertexWriter::TriFan< T > >
 
struct  is_quad< VertexWriter::TriStrip< T > >
 
struct  RepeatDesc
 
struct  Skip
 
struct  TriFan
 
struct  TriStrip
 

Public Member Functions

 VertexWriter ()=default
 
 VertexWriter (void *ptr)
 
 VertexWriter (void *ptr, size_t size)
 
 VertexWriter (void *ptr, Mark end)
 
 VertexWriter (const VertexWriter &)=delete
 
 VertexWriter (VertexWriter &&that)
 
VertexWriteroperator= (const VertexWriter &)=delete
 
VertexWriteroperator= (VertexWriter &&that)
 
VertexWriter makeOffset (size_t offsetInBytes) const
 
template<typename... Args>
void writeQuad (const Args &... remainder)
 
- Public Member Functions inherited from skgpu::BufferWriter
 operator bool () const
 
Mark mark (size_t offset=0) const
 

Static Public Member Functions

template<typename T >
static Conditional< TIf (bool condition, const T &value)
 
template<typename T >
static ArrayDesc< TArray (const T *array, int count)
 
template<int kCount, typename T >
static RepeatDesc< kCount, TRepeat (const T &val)
 
static TriStrip< float > TriStripFromRect (const SkRect &r)
 
static TriStrip< uint16_t > TriStripFromUVs (const std::array< uint16_t, 4 > &rect)
 
static TriFan< float > TriFanFromRect (const SkRect &r)
 

Static Public Attributes

static constexpr uint32_t kIEEE_32_infinity = 0x7f800000
 

Friends

template<typename T >
VertexWriteroperator<< (VertexWriter &, const T &)
 
template<typename T >
VertexWriteroperator<< (VertexWriter &, const ArrayDesc< T > &)
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::BufferWriter
 BufferWriter ()=default
 
 BufferWriter (void *ptr, size_t size)
 
 BufferWriter (void *ptr, Mark end={})
 
BufferWriteroperator= (const BufferWriter &)=delete
 
BufferWriteroperator= (BufferWriter &&that)
 
template<typename W >
W makeOffset (size_t offsetInBytes) const
 
void validate (size_t bytesToWrite) const
 
- Protected Attributes inherited from skgpu::BufferWriter
void * fPtr = nullptr
 

Detailed Description

Helper for writing vertex data to a buffer. Usage: VertexWriter vertices{target->makeVertexSpace(...)}; vertices << A0 << B0 << C0 << ...; vertices << A1 << B1 << C1 << ...;

Each value must be POD (plain old data), or have a specialization of the "<<" operator.

Definition at line 123 of file BufferWriter.h.

Constructor & Destructor Documentation

◆ VertexWriter() [1/6]

skgpu::VertexWriter::VertexWriter ( )
default

◆ VertexWriter() [2/6]

skgpu::VertexWriter::VertexWriter ( void *  ptr)
inlineexplicit

Definition at line 128 of file BufferWriter.h.

128: BufferWriter(ptr, Mark()) {}
BufferWriter()=default

◆ VertexWriter() [3/6]

skgpu::VertexWriter::VertexWriter ( void *  ptr,
size_t  size 
)
inline

Definition at line 130 of file BufferWriter.h.

130: BufferWriter(ptr, size) {}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ VertexWriter() [4/6]

skgpu::VertexWriter::VertexWriter ( void *  ptr,
Mark  end 
)
inline

Definition at line 131 of file BufferWriter.h.

131: BufferWriter(ptr, end) {}

◆ VertexWriter() [5/6]

skgpu::VertexWriter::VertexWriter ( const VertexWriter )
delete

◆ VertexWriter() [6/6]

skgpu::VertexWriter::VertexWriter ( VertexWriter &&  that)
inline

Definition at line 134 of file BufferWriter.h.

134{ *this = std::move(that); }

Member Function Documentation

◆ Array()

template<typename T >
static ArrayDesc< T > skgpu::VertexWriter::Array ( const T array,
int  count 
)
inlinestatic

Definition at line 167 of file BufferWriter.h.

167 {
168 return {array, count};
169 }
int count
Definition: FontMgrTest.cpp:50

◆ If()

template<typename T >
static Conditional< T > skgpu::VertexWriter::If ( bool  condition,
const T value 
)
inlinestatic

Definition at line 153 of file BufferWriter.h.

153 {
154 return {condition, value};
155 }
uint8_t value

◆ makeOffset()

VertexWriter skgpu::VertexWriter::makeOffset ( size_t  offsetInBytes) const
inline

Definition at line 142 of file BufferWriter.h.

142 {
143 return this->BufferWriter::makeOffset<VertexWriter>(offsetInBytes);
144 }

◆ operator=() [1/2]

VertexWriter & skgpu::VertexWriter::operator= ( const VertexWriter )
delete

◆ operator=() [2/2]

VertexWriter & skgpu::VertexWriter::operator= ( VertexWriter &&  that)
inline

Definition at line 137 of file BufferWriter.h.

137 {
138 BufferWriter::operator=(std::move(that));
139 return *this;
140 }
BufferWriter & operator=(const BufferWriter &)=delete

◆ Repeat()

template<int kCount, typename T >
static RepeatDesc< kCount, T > skgpu::VertexWriter::Repeat ( const T val)
inlinestatic

Definition at line 177 of file BufferWriter.h.

177 {
178 return {val};
179 }

◆ TriFanFromRect()

static TriFan< float > skgpu::VertexWriter::TriFanFromRect ( const SkRect r)
inlinestatic

Definition at line 239 of file BufferWriter.h.

239 {
240 return { r.fLeft, r.fTop, r.fRight, r.fBottom };
241 }
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ TriStripFromRect()

static TriStrip< float > skgpu::VertexWriter::TriStripFromRect ( const SkRect r)
inlinestatic

Definition at line 217 of file BufferWriter.h.

217 {
218 return { r.fLeft, r.fTop, r.fRight, r.fBottom };
219 }

◆ TriStripFromUVs()

static TriStrip< uint16_t > skgpu::VertexWriter::TriStripFromUVs ( const std::array< uint16_t, 4 > &  rect)
inlinestatic

Definition at line 221 of file BufferWriter.h.

221 {
222 return { rect[0], rect[1], rect[2], rect[3] };
223 }
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ writeQuad()

template<typename... Args>
void skgpu::VertexWriter::writeQuad ( const Args &...  remainder)
inline

Definition at line 244 of file BufferWriter.h.

244 {
245 this->writeQuadVertex<0>(remainder...);
246 this->writeQuadVertex<1>(remainder...);
247 this->writeQuadVertex<2>(remainder...);
248 this->writeQuadVertex<3>(remainder...);
249 }

Friends And Related Function Documentation

◆ operator<< [1/2]

template<typename T >
VertexWriter & operator<< ( VertexWriter w,
const ArrayDesc< T > &  array 
)
friend

Definition at line 301 of file BufferWriter.h.

301 {
302 static_assert(std::is_trivially_copyable<T>::value, "");
303 w.validate(array.fCount * sizeof(T));
304 memcpy(w.fPtr, array.fArray, array.fCount * sizeof(T));
305 w = w.makeOffset(sizeof(T) * array.fCount);
306 return w;
307}
SkScalar w
#define T
Definition: precompiler.cc:65

◆ operator<< [2/2]

template<typename T >
VertexWriter & operator<< ( VertexWriter w,
const T val 
)
friend

Definition at line 277 of file BufferWriter.h.

277 {
278 static_assert(std::is_trivially_copyable<T>::value, "");
279 w.validate(sizeof(T));
280 memcpy(w.fPtr, &val, sizeof(T));
281 w = w.makeOffset(sizeof(T));
282 return w;
283}

Member Data Documentation

◆ kIEEE_32_infinity

constexpr uint32_t skgpu::VertexWriter::kIEEE_32_infinity = 0x7f800000
inlinestaticconstexpr

Definition at line 124 of file BufferWriter.h.


The documentation for this struct was generated from the following file: