| 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)
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 64 of file vertex_descriptor.cc.

64 {
65 return desc_set_layouts_;
66 }

## ◆ GetHash()

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

Definition at line 38 of file vertex_descriptor.cc.

38 {
39 auto seed = fml::HashCombine();
40 for (const auto& input : inputs_) {
41 fml::HashCombineSeed(seed, input.GetHash());
42 }
43 for (const auto& layout : layouts_) {
44 fml::HashCombineSeed(seed, layout.GetHash());
45 }
46 return seed;
47 }

## ◆ GetStageInputs()

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

Definition at line 54 of file vertex_descriptor.cc.

54 {
55 return inputs_;
56 }

## ◆ GetStageLayouts()

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

Definition at line 58 of file vertex_descriptor.cc.

59 {
60 return layouts_;
61 }

## ◆ IsEqual()

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

Implements impeller::Comparable< VertexDescriptor >.

Definition at line 50 of file vertex_descriptor.cc.

50 {
51 return inputs_ == other.inputs_ && layouts_ == other.layouts_;
52 }

## ◆ RegisterDescriptorSetLayouts() [1/2]

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

Definition at line 28 of file vertex_descriptor.cc.

30 {
31 desc_set_layouts_.reserve(desc_set_layouts_.size() + count);
32 for (size_t i = 0; i < count; i++) {
33 desc_set_layouts_.emplace_back(desc_set_layout[i]);
34 }
35 }

## ◆ RegisterDescriptorSetLayouts() [2/2]

template<size_t Size>

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

Definition at line 42 of file vertex_descriptor.h.

43 {
44 return RegisterDescriptorSetLayouts(inputs.data(), inputs.size());
45 }

## ◆ SetStageInputs() [1/2]

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/2]

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 }

## 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:42