| Flutter Impeller |

Public Member Functions | Static Public Attributes | List of all members
impeller::BackgroundCommandPoolVK Class Referencefinal

## Public Member Functions
| BackgroundCommandPoolVK (BackgroundCommandPoolVK &&)=default
| BackgroundCommandPoolVK (vk::UniqueCommandPool &&pool, std::vector< vk::UniqueCommandBuffer > &&buffers, size_t unused_count, std::weak_ptr< CommandPoolRecyclerVK > recycler)
| ~BackgroundCommandPoolVK ()

## Static Public Attributes
static constexpr size_t | kUnusedCommandBufferLimit = 16u

## Detailed Description

Definition at line 21 of file command_pool_vk.cc.

## Constructor & Destructor Documentation

## ◆ BackgroundCommandPoolVK() [1/2]

impeller::BackgroundCommandPoolVK::BackgroundCommandPoolVK | ( | BackgroundCommandPoolVK && |  | ) |
| default

## ◆ BackgroundCommandPoolVK() [2/2]

impeller::BackgroundCommandPoolVK::BackgroundCommandPoolVK | ( | vk::UniqueCommandPool && | pool,
|  | std::vector< vk::UniqueCommandBuffer > && | buffers,
|  | size_t | unused_count,
|  | std::weak_ptr< CommandPoolRecyclerVK > | recycler
| ) |  |
| inline explicit

Definition at line 29 of file command_pool_vk.cc.

34 : pool_(std::move(pool)),
35 buffers_(std::move(buffers)),
36 unused_count_(unused_count),
37 recycler_(std::move(recycler)) {}

## ◆ ~BackgroundCommandPoolVK()

impeller::BackgroundCommandPoolVK::~BackgroundCommandPoolVK | ( |  | ) |
| inline

Definition at line 39 of file command_pool_vk.cc.

39 {
40 auto const recycler = recycler_.lock();
41
42 // Not only does this prevent recycling when the context is being destroyed,
43 // but it also prevents the destructor from effectively being called twice;
44 // once for the original BackgroundCommandPoolVK() and once for the moved
45 // BackgroundCommandPoolVK().
46 if (!recycler) {
47 return;
48 }
49 // If there are many unused command buffers, release some of them.
50 if (unused_count_ > kUnusedCommandBufferLimit) {
51 for (auto i = 0u; i < unused_count_; i++) {
52 buffers_.pop_back();
53 }
54 }
55
56 recycler->Reclaim(std::move(pool_), std::move(buffers_));
57 }

References kUnusedCommandBufferLimit.

## Member Data Documentation

## ◆ kUnusedCommandBufferLimit

constexpr size_t impeller::BackgroundCommandPoolVK::kUnusedCommandBufferLimit = 16u
| static constexpr

Definition at line 27 of file command_pool_vk.cc.

Referenced by ~BackgroundCommandPoolVK().

The documentation for this class was generated from the following file:

- impeller/renderer/backend/vulkan/command_pool_vk.cc

impeller::BackgroundCommandPoolVK::kUnusedCommandBufferLimit
static constexpr size_t kUnusedCommandBufferLimit
Definition: command_pool_vk.cc:27