| 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
bool | UsesInputAttacments () const
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 73 of file vertex_descriptor.cc.

73 {
74 return desc_set_layouts_;
75 }

## ◆ GetHash()

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

Definition at line 47 of file vertex_descriptor.cc.

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

## ◆ GetStageInputs()

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

Definition at line 63 of file vertex_descriptor.cc.

63 {
64 return inputs_;
65 }

## ◆ GetStageLayouts()

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

Definition at line 67 of file vertex_descriptor.cc.

68 {
69 return layouts_;
70 }

## ◆ IsEqual()

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

Implements impeller::Comparable< VertexDescriptor >.

Definition at line 59 of file vertex_descriptor.cc.

59 {
60 return inputs_ == other.inputs_ && layouts_ == other.layouts_;
61 }

## ◆ 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 uses_input_attachments_ |=
41 desc_set_layout[i].descriptor_type == DescriptorType::kInputAttachment;
42 desc_set_layouts_.emplace_back(desc_set_layout[i]);
43 }
44 }

References impeller::DescriptorSetLayout::descriptor_type, and impeller::kInputAttachment.

## ◆ 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 }

## ◆ UsesInputAttacments()

bool impeller::VertexDescriptor::UsesInputAttacments | ( |  | ) | const

Definition at line 77 of file vertex_descriptor.cc.

77 {
78 return uses_input_attachments_;
79 }

## 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
impeller::DescriptorType::kInputAttachment
@ kInputAttachment