Flutter Engine
The 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
21
22namespace impeller {
23
24// Limit on the total number of buffer and image bindings that allow the Vulkan
25// backend to avoid dynamic heap allocations.
26static constexpr size_t kMaxBindings = 32;
27
28class PipelineVK final
29 : public Pipeline<PipelineDescriptor>,
30 public BackendCast<PipelineVK, Pipeline<PipelineDescriptor>> {
31 public:
32 static std::unique_ptr<PipelineVK> Create(
33 const PipelineDescriptor& desc,
34 const std::shared_ptr<DeviceHolderVK>& device_holder,
35 const std::weak_ptr<PipelineLibrary>& weak_library,
36 std::shared_ptr<SamplerVK> immutable_sampler = {});
37
38 // |Pipeline|
39 ~PipelineVK() override;
40
41 vk::Pipeline GetPipeline() const;
42
43 const vk::PipelineLayout& GetPipelineLayout() const;
44
45 const vk::DescriptorSetLayout& GetDescriptorSetLayout() const;
46
47 std::shared_ptr<PipelineVK> CreateVariantForImmutableSamplers(
48 const std::shared_ptr<SamplerVK>& immutable_sampler) const;
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 mutable Mutex immutable_sampler_variants_mutex_;
66 mutable ImmutableSamplerVariants immutable_sampler_variants_ IPLR_GUARDED_BY(
67 immutable_sampler_variants_mutex_);
68 bool is_valid_ = false;
69
70 PipelineVK(std::weak_ptr<DeviceHolderVK> device_holder,
71 std::weak_ptr<PipelineLibrary> library,
72 const PipelineDescriptor& desc,
73 vk::UniquePipeline pipeline,
74 vk::UniqueRenderPass render_pass,
75 vk::UniquePipelineLayout layout,
76 vk::UniqueDescriptorSetLayout descriptor_set_layout,
77 std::shared_ptr<SamplerVK> immutable_sampler);
78
79 // |Pipeline|
80 bool IsValid() const override;
81
82 PipelineVK(const PipelineVK&) = delete;
83
84 PipelineVK& operator=(const PipelineVK&) = delete;
85};
86
87} // namespace impeller
88
89#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_PIPELINE_VK_H_
static sk_sp< Effect > Create()
std::shared_ptr< PipelineVK > CreateVariantForImmutableSamplers(const std::shared_ptr< SamplerVK > &immutable_sampler) const
bool IsValid() const override
const vk::PipelineLayout & GetPipelineLayout() const
const vk::DescriptorSetLayout & GetDescriptorSetLayout() const
vk::Pipeline GetPipeline() const
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition pipeline.h:49
static constexpr size_t kMaxBindings
Definition pipeline_vk.h:26
fuchsia::ui::composition::LayoutInfo layout_
#define IPLR_GUARDED_BY(x)