Flutter Engine
 
Loading...
Searching...
No Matches
pipeline_vk.h
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
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_PIPELINE_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_PIPELINE_VK_H_
7
8#include <future>
9#include <memory>
10
18
19namespace impeller {
20
21// Limit on the total number of buffer and image bindings that allow the Vulkan
22// backend to avoid dynamic heap allocations.
23static constexpr size_t kMaxBindings = 32;
24
25class PipelineVK final
26 : public Pipeline<PipelineDescriptor>,
27 public BackendCast<PipelineVK, Pipeline<PipelineDescriptor>> {
28 public:
29 static std::unique_ptr<PipelineVK> Create(
30 const PipelineDescriptor& desc,
31 const std::shared_ptr<DeviceHolderVK>& device_holder,
32 const std::weak_ptr<PipelineLibrary>& weak_library,
33 PipelineKey pipeline_key,
34 std::shared_ptr<SamplerVK> immutable_sampler = {});
35
36 // |Pipeline|
37 ~PipelineVK() override;
38
39 vk::Pipeline GetPipeline() const;
40
41 const vk::PipelineLayout& GetPipelineLayout() const;
42
43 const vk::DescriptorSetLayout& GetDescriptorSetLayout() const;
44
45 std::shared_ptr<PipelineVK> CreateVariantForImmutableSamplers(
46 const std::shared_ptr<SamplerVK>& immutable_sampler) const;
47
48 PipelineKey GetPipelineKey() const { return pipeline_key_; }
49
50 private:
51 friend class PipelineLibraryVK;
52
53 using ImmutableSamplerVariants =
54 std::unordered_map<ImmutableSamplerKeyVK,
55 std::shared_ptr<PipelineVK>,
58
59 std::weak_ptr<DeviceHolderVK> device_holder_;
60 vk::UniquePipeline pipeline_;
61 vk::UniqueRenderPass render_pass_;
62 vk::UniquePipelineLayout layout_;
63 vk::UniqueDescriptorSetLayout descriptor_set_layout_;
64 std::shared_ptr<SamplerVK> immutable_sampler_;
65 const PipelineKey pipeline_key_;
66 mutable Mutex immutable_sampler_variants_mutex_;
67 mutable ImmutableSamplerVariants immutable_sampler_variants_
68 IPLR_GUARDED_BY(immutable_sampler_variants_mutex_);
69 bool is_valid_ = false;
70
71 PipelineVK(std::weak_ptr<DeviceHolderVK> device_holder,
72 std::weak_ptr<PipelineLibrary> library,
73 const PipelineDescriptor& desc,
74 vk::UniquePipeline pipeline,
75 vk::UniqueRenderPass render_pass,
76 vk::UniquePipelineLayout layout,
77 vk::UniqueDescriptorSetLayout descriptor_set_layout,
78 PipelineKey pipeline_key,
79 std::shared_ptr<SamplerVK> immutable_sampler);
80
81 // |Pipeline|
82 bool IsValid() const override;
83
84 PipelineVK(const PipelineVK&) = delete;
85
86 PipelineVK& operator=(const PipelineVK&) = delete;
87};
88
89} // namespace impeller
90
91#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_PIPELINE_VK_H_
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition pipeline.h:52
std::shared_ptr< PipelineVK > CreateVariantForImmutableSamplers(const std::shared_ptr< SamplerVK > &immutable_sampler) const
PipelineKey GetPipelineKey() const
Definition pipeline_vk.h:48
const vk::PipelineLayout & GetPipelineLayout() const
const vk::DescriptorSetLayout & GetDescriptorSetLayout() const
vk::Pipeline GetPipeline() const
static std::unique_ptr< PipelineVK > Create(const PipelineDescriptor &desc, const std::shared_ptr< DeviceHolderVK > &device_holder, const std::weak_ptr< PipelineLibrary > &weak_library, PipelineKey pipeline_key, std::shared_ptr< SamplerVK > immutable_sampler={})
int64_t PipelineKey
Definition pipeline.h:21
static constexpr size_t kMaxBindings
Definition pipeline_vk.h:23
fuchsia::ui::composition::LayoutInfo layout_
#define IPLR_GUARDED_BY(x)