Flutter Impeller
descriptor_pool_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 #pragma once
6 
7 #include <optional>
8 #include <queue>
9 
10 #include "flutter/fml/macros.h"
13 
14 namespace impeller {
15 
16 //------------------------------------------------------------------------------
17 /// @brief A short-lived dynamically-sized descriptor pool. Descriptors
18 /// from this pool don't need to be freed individually. Instead, the
19 /// pool must be collected after all the descriptors allocated from
20 /// it are done being used.
21 ///
22 /// The pool or it's descriptors may not be accessed from multiple
23 /// threads.
24 ///
25 /// Encoders create pools as necessary as they have the same
26 /// threading and lifecycle restrictions.
27 ///
29  public:
30  explicit DescriptorPoolVK(
31  const std::weak_ptr<const DeviceHolder>& device_holder);
32 
34 
35  std::optional<vk::DescriptorSet> AllocateDescriptorSet(
36  const vk::DescriptorSetLayout& layout,
37  size_t command_count);
38 
39  private:
40  std::optional<vk::DescriptorSet> AllocateDescriptorSet(
41  const vk::DescriptorSetLayout& layout);
42 
43  std::weak_ptr<const DeviceHolder> device_holder_;
44  uint32_t pool_size_ = 31u;
45  std::queue<vk::UniqueDescriptorPool> pools_;
46 
47  std::optional<vk::DescriptorPool> GetDescriptorPool();
48 
49  bool GrowPool();
50 
51  FML_DISALLOW_COPY_AND_ASSIGN(DescriptorPoolVK);
52 };
53 
54 } // namespace impeller
device_holder.h
impeller::DescriptorPoolVK::~DescriptorPoolVK
~DescriptorPoolVK()
impeller::DescriptorPoolVK::AllocateDescriptorSet
std::optional< vk::DescriptorSet > AllocateDescriptorSet(const vk::DescriptorSetLayout &layout, size_t command_count)
Definition: descriptor_pool_vk.cc:40
vk.h
impeller::DescriptorPoolVK
A short-lived dynamically-sized descriptor pool. Descriptors from this pool don't need to be freed in...
Definition: descriptor_pool_vk.h:28
impeller::DescriptorPoolVK::DescriptorPoolVK
DescriptorPoolVK(const std::weak_ptr< const DeviceHolder > &device_holder)
Definition: descriptor_pool_vk.cc:13
impeller
Definition: aiks_context.cc:10