Flutter Impeller
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 
7 namespace 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 DescriptorSetLayout desc_set_layout[],
30  size_t count) {
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 }
36 
37 // |Comparable<VertexDescriptor>|
38 size_t VertexDescriptor::GetHash() const {
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 }
48 
49 // |Comparable<VertexDescriptor>|
50 bool VertexDescriptor::IsEqual(const VertexDescriptor& other) const {
51  return inputs_ == other.inputs_ && layouts_ == other.layouts_;
52 }
53 
54 const std::vector<ShaderStageIOSlot>& VertexDescriptor::GetStageInputs() const {
55  return inputs_;
56 }
57 
58 const std::vector<ShaderStageBufferLayout>& VertexDescriptor::GetStageLayouts()
59  const {
60  return layouts_;
61 }
62 
63 const std::vector<DescriptorSetLayout>&
65  return desc_set_layouts_;
66 }
67 
68 } // namespace impeller
impeller::ShaderStageIOSlot
Definition: shader_types.h:88
impeller::DescriptorSetLayout
Definition: shader_types.h:149
impeller::VertexDescriptor
Describes the format and layout of vertices expected by the pipeline. While it is possible to constru...
Definition: vertex_descriptor.h:23
impeller::ShaderStageBufferLayout
Definition: shader_types.h:117
impeller::VertexDescriptor::IsEqual
bool IsEqual(const VertexDescriptor &other) const override
Definition: vertex_descriptor.cc:50
vertex_descriptor.h
impeller::VertexDescriptor::VertexDescriptor
VertexDescriptor()
impeller::VertexDescriptor::~VertexDescriptor
virtual ~VertexDescriptor()
impeller::VertexDescriptor::GetDescriptorSetLayouts
const std::vector< DescriptorSetLayout > & GetDescriptorSetLayouts() const
Definition: vertex_descriptor.cc:64
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
impeller::VertexDescriptor::GetStageLayouts
const std::vector< ShaderStageBufferLayout > & GetStageLayouts() const
Definition: vertex_descriptor.cc:58
impeller::VertexDescriptor::GetStageInputs
const std::vector< ShaderStageIOSlot > & GetStageInputs() const
Definition: vertex_descriptor.cc:54
impeller::VertexDescriptor::GetHash
std::size_t GetHash() const override
Definition: vertex_descriptor.cc:38
impeller
Definition: aiks_context.cc:10