Flutter Impeller
compute_pipeline_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 
11 
12 namespace impeller {
13 
15 
17 
18 // Comparable<ComputePipelineDescriptor>
20  auto seed = fml::HashCombine();
21  fml::HashCombineSeed(seed, label_);
22  if (entrypoint_) {
23  fml::HashCombineSeed(seed, entrypoint_->GetHash());
24  }
25  return seed;
26 }
27 
28 // Comparable<ComputePipelineDescriptor>
30  const ComputePipelineDescriptor& other) const {
31  return label_ == other.label_ &&
32  DeepComparePointer(entrypoint_, other.entrypoint_);
33 }
34 
36  std::string_view label) {
37  label_ = label;
38  return *this;
39 }
40 
42  std::shared_ptr<const ShaderFunction> function) {
43  FML_DCHECK(!function || function->GetStage() == ShaderStage::kCompute);
44  if (!function || function->GetStage() != ShaderStage::kCompute) {
45  return *this;
46  }
47 
48  if (function->GetStage() == ShaderStage::kUnknown) {
49  return *this;
50  }
51 
52  entrypoint_ = std::move(function);
53 
54  return *this;
55 }
56 
57 std::shared_ptr<const ShaderFunction>
59  return entrypoint_;
60 }
61 
62 const std::string& ComputePipelineDescriptor::GetLabel() const {
63  return label_;
64 }
65 
67  const DescriptorSetLayout desc_set_layout[],
68  size_t count) {
69  descriptor_set_layouts_.reserve(descriptor_set_layouts_.size() + count);
70  for (size_t i = 0; i < count; i++) {
71  descriptor_set_layouts_.emplace_back(desc_set_layout[i]);
72  }
73  return true;
74 }
75 
76 const std::vector<DescriptorSetLayout>&
78  return descriptor_set_layouts_;
79 }
80 
81 } // namespace impeller
const std::vector< DescriptorSetLayout > & GetDescriptorSetLayouts() const
ComputePipelineDescriptor & SetLabel(std::string_view label)
std::shared_ptr< const ShaderFunction > GetStageEntrypoint() const
bool IsEqual(const ComputePipelineDescriptor &other) const override
ComputePipelineDescriptor & SetStageEntrypoint(std::shared_ptr< const ShaderFunction > function)
bool RegisterDescriptorSetLayouts(const std::array< DescriptorSetLayout, Size > &inputs)
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
Definition: comparable.h:57