5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_POOL_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_POOL_VK_H_
14 #include "vulkan/vulkan_handles.hpp"
19 class CommandPoolRecyclerVK;
41 std::vector<vk::UniqueCommandBuffer>&& buffers,
42 std::weak_ptr<ContextVK>& context)
43 : pool_(
std::move(pool)),
44 unused_command_buffers_(
std::move(buffers)),
70 vk::UniqueCommandPool pool_ IPLR_GUARDED_BY(pool_mutex_);
71 std::vector<vk::UniqueCommandBuffer> unused_command_buffers_;
72 std::weak_ptr<ContextVK>& context_;
75 std::vector<vk::UniqueCommandBuffer> collected_buffers_ IPLR_GUARDED_BY(
104 :
public std::enable_shared_from_this<CommandPoolRecyclerVK> {
124 : context_(
std::move(context)) {}
129 std::shared_ptr<CommandPoolVK>
Get();
134 void Reclaim(vk::UniqueCommandPool&& pool,
135 std::vector<vk::UniqueCommandBuffer>&& buffers);
141 std::weak_ptr<ContextVK> context_;
143 Mutex recycled_mutex_;
144 std::vector<RecycledData> recycled_ IPLR_GUARDED_BY(recycled_mutex_);
149 std::optional<CommandPoolRecyclerVK::RecycledData> Create();
154 std::optional<RecycledData> Reuse();
163 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_POOL_VK_H_