5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_DESCRIPTOR_POOL_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_DESCRIPTOR_POOL_VK_H_
9 #include <unordered_map>
11 #include "fml/status_or.h"
19 std::vector<vk::DescriptorSet>
unused;
20 std::vector<vk::DescriptorSet>
used;
42 std::vector<vk::UniqueDescriptorPool> pools);
47 const vk::DescriptorSetLayout& layout,
54 std::weak_ptr<const ContextVK> context_;
56 std::vector<vk::UniqueDescriptorPool> pools_;
60 fml::Status CreateNewPool(
const ContextVK& context_vk);
71 :
public std::enable_shared_from_this<DescriptorPoolRecyclerVK> {
82 : context_(
std::move(context)) {}
88 vk::UniqueDescriptorPool
Get();
93 std::vector<vk::UniqueDescriptorPool> pools);
96 std::weak_ptr<ContextVK> context_;
98 Mutex recycled_mutex_;
99 std::vector<std::shared_ptr<DescriptorPoolVK>> recycled_ IPLR_GUARDED_BY(
105 vk::UniqueDescriptorPool Create();
Creates and manages the lifecycle of |vk::DescriptorPoolVK| objects.
std::shared_ptr< DescriptorPoolVK > GetDescriptorPool()
DescriptorPoolRecyclerVK(std::weak_ptr< ContextVK > context)
Creates a recycler for the given |ContextVK|.
void Reclaim(DescriptorCacheMap descriptor_sets, std::vector< vk::UniqueDescriptorPool > pools)
vk::UniqueDescriptorPool Get()
Gets a descriptor pool.
~DescriptorPoolRecyclerVK()=default
static constexpr size_t kMaxRecycledPools
The maximum number of descriptor pools this recycler will hold onto.
A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually....
DescriptorPoolVK(std::weak_ptr< const ContextVK > context)
fml::StatusOr< vk::DescriptorSet > AllocateDescriptorSets(const vk::DescriptorSetLayout &layout, PipelineKey pipeline_key, const ContextVK &context_vk)
std::unordered_map< PipelineKey, DescriptorCache > DescriptorCacheMap
Used and un-used descriptor sets.
std::vector< vk::DescriptorSet > unused
std::vector< vk::DescriptorSet > used