| Flutter Impeller |

Public Member Functions | Static Public Attributes | List of all members
impeller::VertexDescriptor Class Referencefinal

Describes the format and layout of vertices expected by the pipeline. While it is possible to construct these descriptors manually, it would be tedious to do so. These are usually constructed using shader information reflected using `impellerc`. The usage of this class is indirectly via `PipelineBuilder<VS, FS>`. More...

`#include <vertex_descriptor.h>`

Inheritance diagram for impeller::VertexDescriptor:

## Public Member Functions
| VertexDescriptor ()
virtual | ~VertexDescriptor ()
template<size_t Size, size_t LayoutSize>
void | SetStageInputs (const std::array< const ShaderStageIOSlot *, Size > &inputs, const std::array< const ShaderStageBufferLayout *, LayoutSize > &layout)
void | SetStageInputs (const std::vector< ShaderStageIOSlot > &inputs, const std::vector< ShaderStageBufferLayout > &layout)
template<size_t Size>
void | RegisterDescriptorSetLayouts (const std::array< DescriptorSetLayout, Size > &inputs)
void | SetStageInputs (const ShaderStageIOSlot *const stage_inputs[], size_t count, const ShaderStageBufferLayout *const stage_layout[], size_t layout_count)
void | RegisterDescriptorSetLayouts (const DescriptorSetLayout desc_set_layout[], size_t count)
const std::vector< ShaderStageIOSlot > & | GetStageInputs () const
const std::vector< ShaderStageBufferLayout > & | GetStageLayouts () const
const std::vector< DescriptorSetLayout > & | GetDescriptorSetLayouts () const
std::size_t | GetHash () const override
bool | IsEqual (const VertexDescriptor &other) const override
Public Member Functions inherited from impeller::Comparable< VertexDescriptor >
virtual std::size_t | GetHash () const=0

## Static Public Attributes
static constexpr size_t | kReservedVertexBufferIndex

## Detailed Description

Describes the format and layout of vertices expected by the pipeline. While it is possible to construct these descriptors manually, it would be tedious to do so. These are usually constructed using shader information reflected using `impellerc`. The usage of this class is indirectly via `PipelineBuilder<VS, FS>`.

Definition at line 23 of file vertex_descriptor.h.

## Constructor & Destructor Documentation

## ◆ VertexDescriptor()

impeller::VertexDescriptor::VertexDescriptor | ( |  | ) |
| default

## ◆ ~VertexDescriptor()

impeller::VertexDescriptor::~VertexDescriptor | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ GetDescriptorSetLayouts()

const std::vector< DescriptorSetLayout > & impeller::VertexDescriptor::GetDescriptorSetLayouts | ( |  | ) | const

Definition at line 71 of file vertex_descriptor.cc.

71 {
72 return desc_set_layouts_;
73 }

## ◆ GetHash()

size_t impeller::VertexDescriptor::GetHash | ( |  | ) | const
| override

Definition at line 45 of file vertex_descriptor.cc.

45 {
46 auto seed = fml::HashCombine();
47 for (const auto& input : inputs_) {
48 fml::HashCombineSeed(seed, input.GetHash());
49 }
50 for (const auto& layout : layouts_) {
51 fml::HashCombineSeed(seed, layout.GetHash());
52 }
53 return seed;
54 }

## ◆ GetStageInputs()

const std::vector< ShaderStageIOSlot > & impeller::VertexDescriptor::GetStageInputs | ( |  | ) | const

Definition at line 61 of file vertex_descriptor.cc.

61 {
62 return inputs_;
63 }

## ◆ GetStageLayouts()

const std::vector< ShaderStageBufferLayout > & impeller::VertexDescriptor::GetStageLayouts | ( |  | ) | const

Definition at line 65 of file vertex_descriptor.cc.

66 {
67 return layouts_;
68 }

## ◆ IsEqual()

bool impeller::VertexDescriptor::IsEqual | ( | const VertexDescriptor & | other | ) | const
| override virtual

Implements impeller::Comparable< VertexDescriptor >.

Definition at line 57 of file vertex_descriptor.cc.

57 {
58 return inputs_ == other.inputs_ && layouts_ == other.layouts_;
59 }

## ◆ RegisterDescriptorSetLayouts() [1/2]

void impeller::VertexDescriptor::RegisterDescriptorSetLayouts | ( | const DescriptorSetLayout | desc_set_layout[],
|  | size_t | count
| ) |  |

Definition at line 35 of file vertex_descriptor.cc.

37 {
38 desc_set_layouts_.reserve(desc_set_layouts_.size() + count);
39 for (size_t i = 0; i < count; i++) {
40 desc_set_layouts_.emplace_back(desc_set_layout[i]);
41 }
42 }

## ◆ RegisterDescriptorSetLayouts() [2/2]

template<size_t Size>

void impeller::VertexDescriptor::RegisterDescriptorSetLayouts | ( | const std::array< DescriptorSetLayout, Size > & | inputs | ) |
| inline

Definition at line 45 of file vertex_descriptor.h.

46 {
47 return RegisterDescriptorSetLayouts(inputs.data(), inputs.size());
48 }

## ◆ SetStageInputs() [1/3]

void impeller::VertexDescriptor::SetStageInputs | ( | const ShaderStageIOSlot *const | stage_inputs[],
|  | size_t | count,
|  | const ShaderStageBufferLayout *const | stage_layout[],
|  | size_t | layout_count
| ) |  |

Definition at line 13 of file vertex_descriptor.cc.

17 {
18 inputs_.reserve(inputs_.size() + count);
19 layouts_.reserve(layouts_.size() + layout_count);
20 for (size_t i = 0; i < count; i++) {
21 inputs_.emplace_back(*stage_inputs[i]);
22 }
23 for (size_t i = 0; i < layout_count; i++) {
24 layouts_.emplace_back(*stage_layout[i]);
25 }
26 }

## ◆ SetStageInputs() [2/3]

template<size_t Size, size_t LayoutSize>

void impeller::VertexDescriptor::SetStageInputs | ( | const std::array< const ShaderStageIOSlot *, Size > & | inputs,
|  | const std::array< const ShaderStageBufferLayout *, LayoutSize > & | layout
| ) |  |
| inline

Definition at line 34 of file vertex_descriptor.h.

36 {
37 return SetStageInputs(inputs.data(), inputs.size(), layout.data(),
38 layout.size());
39 }

## ◆ SetStageInputs() [3/3]

void impeller::VertexDescriptor::SetStageInputs | ( | const std::vector< ShaderStageIOSlot > & | inputs,
|  | const std::vector< ShaderStageBufferLayout > & | layout
| ) |  |

Definition at line 28 of file vertex_descriptor.cc.

30 {
31 inputs_.insert(inputs_.end(), inputs.begin(), inputs.end());
32 layouts_.insert(layouts_.end(), layout.begin(), layout.end());
33 }

## Member Data Documentation

## ◆ kReservedVertexBufferIndex

constexpr size_t impeller::VertexDescriptor::kReservedVertexBufferIndex
| static constexpr

Initial value:
=
30u

Definition at line 25 of file vertex_descriptor.h.

Referenced by impeller::VertexDescriptorMTL::SetStageInputsAndLayout().

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

- impeller/renderer/vertex_descriptor.h
- impeller/renderer/vertex_descriptor.cc

impeller::VertexDescriptor::SetStageInputs
void SetStageInputs(const std::array< const ShaderStageIOSlot *, Size > &inputs, const std::array< const ShaderStageBufferLayout *, LayoutSize > &layout)
Definition: vertex_descriptor.h:34
impeller::VertexDescriptor::RegisterDescriptorSetLayouts
void RegisterDescriptorSetLayouts(const std::array< DescriptorSetLayout, Size > &inputs)
Definition: vertex_descriptor.h:45