Creates and manages the lifecycle of |vk::DescriptorPoolVK| objects. More...
#include <descriptor_pool_vk.h>
Public Member Functions | |
| ~DescriptorPoolRecyclerVK ()=default | |
| DescriptorPoolRecyclerVK (std::weak_ptr< ContextVK > context) | |
| Creates a recycler for the given |ContextVK|. More... | |
| DescriptorPoolAndSize | Get (uint32_t minimum_capacity) |
| Gets a descriptor pool with at least [minimum_capacity] sampler and slots. More... | |
| void | Reclaim (vk::UniqueDescriptorPool &&pool, uint32_t allocated_capacity) |
| Returns the descriptor pool to be reset on a background thread. More... | |
Static Public Attributes | |
| static constexpr size_t | kMaxRecycledPools = 32u |
| The maximum number of descriptor pools this recycler will hold onto. More... | |
Creates and manages the lifecycle of |vk::DescriptorPoolVK| objects.
To make descriptor pool recycling more effective, the number of requusted descriptor slots is rounded up the nearest power of two. This also makes determining whether a recycled pool has sufficient slots easier as only a single number comparison is required.
We round up to a minimum of 64 as the smallest power of two to reduce the range of potential allocations to approximately: 64, 128, 256, 512, 1024, 2048, 4096. Beyond this size applications will have far too many drawing commands to render correctly. We also limit the number of cached descriptor pools to 32, which is somewhat arbitrarily chosen, but given 2-ish frames in flight is about 16 descriptors pools per frame which is extremely generous.
Definition at line 67 of file descriptor_pool_vk.h.
|
default |
|
inlineexplicit |
Creates a recycler for the given |ContextVK|.
| [in] | context | The context to create the recycler for. |
Definition at line 78 of file descriptor_pool_vk.h.
| DescriptorPoolAndSize impeller::DescriptorPoolRecyclerVK::Get | ( | uint32_t | minimum_capacity | ) |
Gets a descriptor pool with at least [minimum_capacity] sampler and slots.
This may create a new descriptor pool if no existing pools had the necessary capacity.
Definition at line 158 of file descriptor_pool_vk.cc.
References impeller::Allocation::NextPowerOfTwoSize().
| void impeller::DescriptorPoolRecyclerVK::Reclaim | ( | vk::UniqueDescriptorPool && | pool, |
| uint32_t | allocated_capacity | ||
| ) |
Returns the descriptor pool to be reset on a background thread.
| [in] | pool | The pool to recycler. |
Definition at line 117 of file descriptor_pool_vk.cc.
References kMaxRecycledPools.
|
staticconstexpr |
The maximum number of descriptor pools this recycler will hold onto.
Definition at line 73 of file descriptor_pool_vk.h.
Referenced by Reclaim().