Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
impeller::VertexBufferBuilder< VertexType_, IndexType_ > Class Template Reference

#include <vertex_buffer_builder.h>

Public Types

using VertexType = VertexType_
 
using IndexType = IndexType_
 

Public Member Functions

 VertexBufferBuilder ()=default
 
 ~VertexBufferBuilder ()=default
 
constexpr impeller::IndexType GetIndexType () const
 
void SetLabel (const std::string &label)
 
void Reserve (size_t count)
 
void ReserveIndices (size_t count)
 
bool HasVertices () const
 
size_t GetVertexCount () const
 
size_t GetIndexCount () const
 
const VertexTypeLast () const
 
VertexBufferBuilderAppendVertex (VertexType_ vertex)
 
VertexBufferBuilderAddVertices (std::initializer_list< VertexType_ > vertices)
 
VertexBufferBuilderAppendIndex (IndexType_ index)
 
VertexBuffer CreateVertexBuffer (HostBuffer &host_buffer) const
 
VertexBuffer CreateVertexBuffer (Allocator &device_allocator) const
 
void IterateVertices (const std::function< void(VertexType &)> &iterator)
 

Detailed Description

template<class VertexType_, class IndexType_ = uint16_t>
class impeller::VertexBufferBuilder< VertexType_, IndexType_ >

Definition at line 21 of file vertex_buffer_builder.h.

Member Typedef Documentation

◆ IndexType

template<class VertexType_ , class IndexType_ = uint16_t>
using impeller::VertexBufferBuilder< VertexType_, IndexType_ >::IndexType = IndexType_

Definition at line 24 of file vertex_buffer_builder.h.

◆ VertexType

template<class VertexType_ , class IndexType_ = uint16_t>
using impeller::VertexBufferBuilder< VertexType_, IndexType_ >::VertexType = VertexType_

Definition at line 23 of file vertex_buffer_builder.h.

Constructor & Destructor Documentation

◆ VertexBufferBuilder()

template<class VertexType_ , class IndexType_ = uint16_t>
impeller::VertexBufferBuilder< VertexType_, IndexType_ >::VertexBufferBuilder ( )
default

◆ ~VertexBufferBuilder()

template<class VertexType_ , class IndexType_ = uint16_t>
impeller::VertexBufferBuilder< VertexType_, IndexType_ >::~VertexBufferBuilder ( )
default

Member Function Documentation

◆ AddVertices()

template<class VertexType_ , class IndexType_ = uint16_t>
VertexBufferBuilder & impeller::VertexBufferBuilder< VertexType_, IndexType_ >::AddVertices ( std::initializer_list< VertexType_ >  vertices)
inline

Definition at line 67 of file vertex_buffer_builder.h.

68 {
69 vertices_.reserve(vertices.size());
70 for (auto& vertex : vertices) {
71 vertices_.emplace_back(std::move(vertex));
72 }
73 return *this;
74 }

◆ AppendIndex()

template<class VertexType_ , class IndexType_ = uint16_t>
VertexBufferBuilder & impeller::VertexBufferBuilder< VertexType_, IndexType_ >::AppendIndex ( IndexType_  index)
inline

Definition at line 76 of file vertex_buffer_builder.h.

76 {
77 indices_.emplace_back(index);
78 return *this;
79 }

◆ AppendVertex()

template<class VertexType_ , class IndexType_ = uint16_t>
VertexBufferBuilder & impeller::VertexBufferBuilder< VertexType_, IndexType_ >::AppendVertex ( VertexType_  vertex)
inline

Definition at line 62 of file vertex_buffer_builder.h.

62 {
63 vertices_.emplace_back(std::move(vertex));
64 return *this;
65 }

◆ CreateVertexBuffer() [1/2]

template<class VertexType_ , class IndexType_ = uint16_t>
VertexBuffer impeller::VertexBufferBuilder< VertexType_, IndexType_ >::CreateVertexBuffer ( Allocator device_allocator) const
inline

Definition at line 90 of file vertex_buffer_builder.h.

90 {
92 // This can be merged into a single allocation.
93 buffer.vertex_buffer = CreateVertexBufferView(device_allocator);
94 buffer.index_buffer = CreateIndexBufferView(device_allocator);
95 buffer.vertex_count = GetIndexCount();
96 buffer.index_type = GetIndexType();
97 return buffer;
98 };
constexpr impeller::IndexType GetIndexType() const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ CreateVertexBuffer() [2/2]

template<class VertexType_ , class IndexType_ = uint16_t>
VertexBuffer impeller::VertexBufferBuilder< VertexType_, IndexType_ >::CreateVertexBuffer ( HostBuffer host_buffer) const
inline

Definition at line 81 of file vertex_buffer_builder.h.

81 {
83 buffer.vertex_buffer = CreateVertexBufferView(host_buffer);
84 buffer.index_buffer = CreateIndexBufferView(host_buffer);
85 buffer.vertex_count = GetIndexCount();
86 buffer.index_type = GetIndexType();
87 return buffer;
88 };

◆ GetIndexCount()

template<class VertexType_ , class IndexType_ = uint16_t>
size_t impeller::VertexBufferBuilder< VertexType_, IndexType_ >::GetIndexCount ( ) const
inline

Definition at line 53 of file vertex_buffer_builder.h.

53 {
54 return indices_.size() > 0 ? indices_.size() : vertices_.size();
55 }

◆ GetIndexType()

template<class VertexType_ , class IndexType_ = uint16_t>
constexpr impeller::IndexType impeller::VertexBufferBuilder< VertexType_, IndexType_ >::GetIndexType ( ) const
inlineconstexpr

Definition at line 30 of file vertex_buffer_builder.h.

30 {
31 if (indices_.size() == 0) {
33 }
34 if constexpr (sizeof(IndexType) == 2) {
36 }
37 if (sizeof(IndexType) == 4) {
39 }
41 }
@ kNone
Does not use the index buffer.

◆ GetVertexCount()

template<class VertexType_ , class IndexType_ = uint16_t>
size_t impeller::VertexBufferBuilder< VertexType_, IndexType_ >::GetVertexCount ( ) const
inline

Definition at line 51 of file vertex_buffer_builder.h.

51{ return vertices_.size(); }

◆ HasVertices()

template<class VertexType_ , class IndexType_ = uint16_t>
bool impeller::VertexBufferBuilder< VertexType_, IndexType_ >::HasVertices ( ) const
inline

Definition at line 49 of file vertex_buffer_builder.h.

49{ return !vertices_.empty(); }

◆ IterateVertices()

template<class VertexType_ , class IndexType_ = uint16_t>
void impeller::VertexBufferBuilder< VertexType_, IndexType_ >::IterateVertices ( const std::function< void(VertexType &)> &  iterator)
inline

Definition at line 100 of file vertex_buffer_builder.h.

100 {
101 for (auto& vertex : vertices_) {
102 iterator(vertex);
103 }
104 }

◆ Last()

template<class VertexType_ , class IndexType_ = uint16_t>
const VertexType & impeller::VertexBufferBuilder< VertexType_, IndexType_ >::Last ( ) const
inline

Definition at line 57 of file vertex_buffer_builder.h.

57 {
58 FML_DCHECK(!vertices_.empty());
59 return vertices_.back();
60 }
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ Reserve()

template<class VertexType_ , class IndexType_ = uint16_t>
void impeller::VertexBufferBuilder< VertexType_, IndexType_ >::Reserve ( size_t  count)
inline

Definition at line 45 of file vertex_buffer_builder.h.

45{ return vertices_.reserve(count); }
int count
Definition: FontMgrTest.cpp:50

◆ ReserveIndices()

template<class VertexType_ , class IndexType_ = uint16_t>
void impeller::VertexBufferBuilder< VertexType_, IndexType_ >::ReserveIndices ( size_t  count)
inline

Definition at line 47 of file vertex_buffer_builder.h.

47{ return indices_.reserve(count); }

◆ SetLabel()

template<class VertexType_ , class IndexType_ = uint16_t>
void impeller::VertexBufferBuilder< VertexType_, IndexType_ >::SetLabel ( const std::string &  label)
inline

Definition at line 43 of file vertex_buffer_builder.h.

43{ label_ = label; }

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