Flutter Engine
The Flutter Engine
|
Creates and manages the lifecycle of |vk::CommandPool| objects. More...
#include <command_pool_vk.h>
Classes | |
struct | RecycledData |
A unique command pool and zero or more recycled command buffers. More... | |
Public Member Functions | |
~CommandPoolRecyclerVK () | |
CommandPoolRecyclerVK (std::weak_ptr< ContextVK > context) | |
Creates a recycler for the given |ContextVK|. More... | |
std::shared_ptr< CommandPoolVK > | Get () |
Gets a command pool for the current thread. More... | |
void | Reclaim (vk::UniqueCommandPool &&pool, std::vector< vk::UniqueCommandBuffer > &&buffers) |
Returns a command pool to be reset on a background thread. More... | |
void | Dispose () |
Clears all recycled command pools to let them be reclaimed. More... | |
Static Public Member Functions | |
static void | DestroyThreadLocalPools (const ContextVK *context) |
Clean up resources held by all per-thread command pools associated with the given context. More... | |
Creates and manages the lifecycle of |vk::CommandPool| objects.
A |vk::CommandPool| is expensive to create and reset. This class manages the lifecycle of |vk::CommandPool| objects by creating and recycling them; or in other words, a pool for command pools.
A single instance should be created per |ContextVK|.
Every "frame", a single |CommandPoolResourceVk| is made available for each thread that calls |Get|. After calling |Dispose|, the current thread's pool is moved to a background thread, reset, and made available for the next time |Get| is called and needs to create a command pool.
Commands in the command pool are not necessarily done executing when the pool is recycled, when all references are dropped to the pool, they are reset and returned to the pool of available pools.
Definition at line 103 of file command_pool_vk.h.
impeller::CommandPoolRecyclerVK::~CommandPoolRecyclerVK | ( | ) |
Definition at line 273 of file command_pool_vk.cc.
|
inlineexplicit |
Creates a recycler for the given |ContextVK|.
[in] | context | The context to create the recycler for. |
Definition at line 123 of file command_pool_vk.h.
|
static |
Clean up resources held by all per-thread command pools associated with the given context.
[in] | context | The context. |
Definition at line 285 of file command_pool_vk.cc.
void impeller::CommandPoolRecyclerVK::Dispose | ( | ) |
Clears all recycled command pools to let them be reclaimed.
Definition at line 278 of file command_pool_vk.cc.
std::shared_ptr< CommandPoolVK > impeller::CommandPoolRecyclerVK::Get | ( | ) |
Gets a command pool for the current thread.
Definition at line 181 of file command_pool_vk.cc.
void impeller::CommandPoolRecyclerVK::Reclaim | ( | vk::UniqueCommandPool && | pool, |
std::vector< vk::UniqueCommandBuffer > && | buffers | ||
) |
Returns a command pool to be reset on a background thread.
[in] | pool | The pool to recycler. |
Definition at line 256 of file command_pool_vk.cc.