Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
vertex_descriptor.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7namespace impeller {
8
10
12
14 const ShaderStageIOSlot* const stage_inputs[],
15 size_t count,
16 const ShaderStageBufferLayout* const stage_layout[],
17 size_t layout_count) {
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}
27
29 const std::vector<ShaderStageIOSlot>& inputs,
30 const std::vector<ShaderStageBufferLayout>& layout) {
31 inputs_.insert(inputs_.end(), inputs.begin(), inputs.end());
32 layouts_.insert(layouts_.end(), layout.begin(), layout.end());
33}
34
36 const DescriptorSetLayout desc_set_layout[],
37 size_t count) {
38 desc_set_layouts_.reserve(desc_set_layouts_.size() + count);
39 for (size_t i = 0; i < count; i++) {
40 uses_input_attachments_ |=
42 desc_set_layouts_.emplace_back(desc_set_layout[i]);
43 }
44}
45
46// |Comparable<VertexDescriptor>|
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}
57
58// |Comparable<VertexDescriptor>|
60 return inputs_ == other.inputs_ && layouts_ == other.layouts_;
61}
62
63const std::vector<ShaderStageIOSlot>& VertexDescriptor::GetStageInputs() const {
64 return inputs_;
65}
66
67const std::vector<ShaderStageBufferLayout>& VertexDescriptor::GetStageLayouts()
68 const {
69 return layouts_;
70}
71
72const std::vector<DescriptorSetLayout>&
74 return desc_set_layouts_;
75}
76
78 return uses_input_attachments_;
79}
80
81} // namespace impeller
int count
Describes the format and layout of vertices expected by the pipeline. While it is possible to constru...
const std::vector< ShaderStageIOSlot > & GetStageInputs() const
void RegisterDescriptorSetLayouts(const std::array< DescriptorSetLayout, Size > &inputs)
bool IsEqual(const VertexDescriptor &other) const override
const std::vector< DescriptorSetLayout > & GetDescriptorSetLayouts() const
const std::vector< ShaderStageBufferLayout > & GetStageLayouts() const
std::size_t GetHash() const override
void SetStageInputs(const std::array< const ShaderStageIOSlot *, Size > &inputs, const std::array< const ShaderStageBufferLayout *, LayoutSize > &layout)
constexpr std::size_t HashCombine()
constexpr void HashCombineSeed(std::size_t &seed, Type arg)