Flutter Engine
 
Loading...
Searching...
No Matches
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 22 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 
)
inlineexplicit

Definition at line 30 of file command_pool_vk.cc.

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

◆ ~BackgroundCommandPoolVK()

impeller::BackgroundCommandPoolVK::~BackgroundCommandPoolVK ( )
inline

Definition at line 40 of file command_pool_vk.cc.

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

References kUnusedCommandBufferLimit.

Member Data Documentation

◆ kUnusedCommandBufferLimit

constexpr size_t impeller::BackgroundCommandPoolVK::kUnusedCommandBufferLimit = 16u
staticconstexpr

Definition at line 28 of file command_pool_vk.cc.

Referenced by ~BackgroundCommandPoolVK().


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