Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 473bab2

Browse files
authored
Add a comment explaining the lifecycle of tls_command_pool_map. (#50623)
Partial work towards flutter/flutter#142083. Still investigating a fix.
1 parent f89bde0 commit 473bab2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

impeller/renderer/backend/vulkan/command_pool_vk.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ void CommandPoolVK::Destroy() {
158158
// Associates a resource with a thread and context.
159159
using CommandPoolMap =
160160
std::unordered_map<uint64_t, std::shared_ptr<CommandPoolVK>>;
161+
162+
// CommandPoolVK Lifecycle:
163+
// 1. End of frame will reset the command pool (clearing this on a thread).
164+
// There will still be references to the command pool from the uncompleted
165+
// command buffers.
166+
// 2. The last reference to the command pool will be released from the fence
167+
// waiter thread, which will schedule a task on the resource
168+
// manager thread, which in turn will reset the command pool and make it
169+
// available for reuse ("recycle").
161170
static thread_local std::unique_ptr<CommandPoolMap> tls_command_pool_map;
162171

163172
// Map each context to a list of all thread-local command pools associated

0 commit comments

Comments
 (0)