From 536007a420c472e0d9c7481d42b1cb021817c0dd Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 17 Oct 2024 16:39:37 -0700 Subject: [PATCH 01/11] [Impeller] one descriptor pool per frame. --- .../backend/vulkan/command_buffer_vk.cc | 6 ++--- .../backend/vulkan/command_buffer_vk.h | 4 +-- .../renderer/backend/vulkan/context_vk.cc | 26 ++++++++++++++----- .../backend/vulkan/surface_context_vk.cc | 2 +- .../backend/vulkan/tracked_objects_vk.cc | 5 ++-- .../backend/vulkan/tracked_objects_vk.h | 3 ++- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/impeller/renderer/backend/vulkan/command_buffer_vk.cc b/impeller/renderer/backend/vulkan/command_buffer_vk.cc index abe4971298c28..3d432f3576ee3 100644 --- a/impeller/renderer/backend/vulkan/command_buffer_vk.cc +++ b/impeller/renderer/backend/vulkan/command_buffer_vk.cc @@ -22,12 +22,10 @@ namespace impeller { CommandBufferVK::CommandBufferVK( std::weak_ptr context, std::weak_ptr device_holder, - std::shared_ptr tracked_objects, - std::shared_ptr fence_waiter) + std::shared_ptr tracked_objects) : CommandBuffer(std::move(context)), device_holder_(std::move(device_holder)), - tracked_objects_(std::move(tracked_objects)), - fence_waiter_(std::move(fence_waiter)) {} + tracked_objects_(std::move(tracked_objects)) {} CommandBufferVK::~CommandBufferVK() = default; diff --git a/impeller/renderer/backend/vulkan/command_buffer_vk.h b/impeller/renderer/backend/vulkan/command_buffer_vk.h index 6a78787f1dce5..aee53db409a58 100644 --- a/impeller/renderer/backend/vulkan/command_buffer_vk.h +++ b/impeller/renderer/backend/vulkan/command_buffer_vk.h @@ -87,12 +87,10 @@ class CommandBufferVK final std::weak_ptr device_holder_; std::shared_ptr tracked_objects_; - std::shared_ptr fence_waiter_; CommandBufferVK(std::weak_ptr context, std::weak_ptr device_holder, - std::shared_ptr tracked_objects, - std::shared_ptr fence_waiter); + std::shared_ptr tracked_objects); // |CommandBuffer| void SetLabel(std::string_view label) const override; diff --git a/impeller/renderer/backend/vulkan/context_vk.cc b/impeller/renderer/backend/vulkan/context_vk.cc index 222646983fb6f..46e582a49b7b1 100644 --- a/impeller/renderer/backend/vulkan/context_vk.cc +++ b/impeller/renderer/backend/vulkan/context_vk.cc @@ -6,6 +6,7 @@ #include "fml/concurrent_message_loop.h" #include "impeller/renderer/backend/vulkan/command_queue_vk.h" +#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/render_pass_builder_vk.h" #include "impeller/renderer/render_target.h" @@ -489,15 +490,28 @@ std::shared_ptr ContextVK::GetPipelineLibrary() const { return pipeline_library_; } +// DescriptorPool Lifecycle: +// 1. End of frame will reset the descriptor pool (clearing this on a thread). +// There will still be references to the descriptor pool from the uncompleted +// command buffers. +// 2. The last reference to the descriptor pool will be released from the fence +// waiter thread, which will schedule a task on the resource +// manager thread, which in turn will reset the command pool and make it +// available for reuse ("recycle"). +static thread_local std::shared_ptr tls_descriptor_pool; + std::shared_ptr ContextVK::CreateCommandBuffer() const { const auto& recycler = GetCommandPoolRecycler(); auto tls_pool = recycler->Get(); if (!tls_pool) { return nullptr; } - + if (!tls_descriptor_pool) { + tls_descriptor_pool = std::make_shared(weak_from_this()); + } auto tracked_objects = std::make_shared( - weak_from_this(), std::move(tls_pool), GetGPUTracer()->CreateGPUProbe()); + weak_from_this(), std::move(tls_pool), tls_descriptor_pool, + GetGPUTracer()->CreateGPUProbe()); auto queue = GetGraphicsQueue(); if (!tracked_objects || !tracked_objects->IsValid() || !queue) { @@ -516,10 +530,9 @@ std::shared_ptr ContextVK::CreateCommandBuffer() const { tracked_objects->GetCommandBuffer()); return std::shared_ptr(new CommandBufferVK( - shared_from_this(), // - GetDeviceHolder(), // - std::move(tracked_objects), // - GetFenceWaiter() // + shared_from_this(), // + GetDeviceHolder(), // + std::move(tracked_objects) // )); } @@ -631,6 +644,7 @@ void ContextVK::InitializeCommonlyUsedShadersIfNeeded() const { void ContextVK::DisposeThreadLocalCachedResources() { command_pool_recycler_->Dispose(); + tls_descriptor_pool.reset(); } const std::shared_ptr& diff --git a/impeller/renderer/backend/vulkan/surface_context_vk.cc b/impeller/renderer/backend/vulkan/surface_context_vk.cc index 912c74b03c056..b5ddd61a04e01 100644 --- a/impeller/renderer/backend/vulkan/surface_context_vk.cc +++ b/impeller/renderer/backend/vulkan/surface_context_vk.cc @@ -86,7 +86,7 @@ std::unique_ptr SurfaceContextVK::AcquireNextSurface() { impeller::PipelineLibraryVK::Cast(*pipeline_library) .DidAcquireSurfaceFrame(); } - parent_->GetCommandPoolRecycler()->Dispose(); + DisposeThreadLocalCachedResources(); parent_->GetResourceAllocator()->DebugTraceMemoryStatistics(); return surface; } diff --git a/impeller/renderer/backend/vulkan/tracked_objects_vk.cc b/impeller/renderer/backend/vulkan/tracked_objects_vk.cc index 47b8477309dcb..4bbaf94319d8c 100644 --- a/impeller/renderer/backend/vulkan/tracked_objects_vk.cc +++ b/impeller/renderer/backend/vulkan/tracked_objects_vk.cc @@ -11,8 +11,9 @@ namespace impeller { TrackedObjectsVK::TrackedObjectsVK( const std::weak_ptr& context, const std::shared_ptr& pool, + std::shared_ptr descriptor_pool, std::unique_ptr probe) - : desc_pool_(context), probe_(std::move(probe)) { + : desc_pool_(std::move(descriptor_pool)), probe_(std::move(probe)) { if (!pool) { return; } @@ -78,7 +79,7 @@ vk::CommandBuffer TrackedObjectsVK::GetCommandBuffer() const { } DescriptorPoolVK& TrackedObjectsVK::GetDescriptorPool() { - return desc_pool_; + return *desc_pool_; } GPUProbe& TrackedObjectsVK::GetGPUProbe() const { diff --git a/impeller/renderer/backend/vulkan/tracked_objects_vk.h b/impeller/renderer/backend/vulkan/tracked_objects_vk.h index b502eac1a2b20..8305f51160380 100644 --- a/impeller/renderer/backend/vulkan/tracked_objects_vk.h +++ b/impeller/renderer/backend/vulkan/tracked_objects_vk.h @@ -20,6 +20,7 @@ class TrackedObjectsVK { public: explicit TrackedObjectsVK(const std::weak_ptr& context, const std::shared_ptr& pool, + std::shared_ptr descriptor_pool, std::unique_ptr probe); ~TrackedObjectsVK(); @@ -43,7 +44,7 @@ class TrackedObjectsVK { GPUProbe& GetGPUProbe() const; private: - DescriptorPoolVK desc_pool_; + std::shared_ptr desc_pool_; // `shared_ptr` since command buffers have a link to the command pool. std::shared_ptr pool_; vk::UniqueCommandBuffer buffer_; From 6ab44605f94dea34eed5b44fb1debdad46b70fac Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 17 Oct 2024 17:02:17 -0700 Subject: [PATCH 02/11] add unit test. --- .../backend/vulkan/command_buffer_vk.cc | 4 ++++ .../backend/vulkan/command_buffer_vk.h | 4 ++++ .../vulkan/descriptor_pool_vk_unittests.cc | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/impeller/renderer/backend/vulkan/command_buffer_vk.cc b/impeller/renderer/backend/vulkan/command_buffer_vk.cc index 3d432f3576ee3..e8341a352c8f9 100644 --- a/impeller/renderer/backend/vulkan/command_buffer_vk.cc +++ b/impeller/renderer/backend/vulkan/command_buffer_vk.cc @@ -210,4 +210,8 @@ void CommandBufferVK::InsertDebugMarker(std::string_view label) const { } } +DescriptorPoolVK& CommandBufferVK::GetDescriptorPool() const { + return tracked_objects_->GetDescriptorPool(); +} + } // namespace impeller diff --git a/impeller/renderer/backend/vulkan/command_buffer_vk.h b/impeller/renderer/backend/vulkan/command_buffer_vk.h index aee53db409a58..ef9dba2494975 100644 --- a/impeller/renderer/backend/vulkan/command_buffer_vk.h +++ b/impeller/renderer/backend/vulkan/command_buffer_vk.h @@ -8,6 +8,7 @@ #include "fml/status_or.h" #include "impeller/base/backend_cast.h" #include "impeller/renderer/backend/vulkan/command_queue_vk.h" +#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/device_holder_vk.h" #include "impeller/renderer/backend/vulkan/texture_source_vk.h" #include "impeller/renderer/backend/vulkan/tracked_objects_vk.h" @@ -81,6 +82,9 @@ class CommandBufferVK final // Visible for testing. bool IsTracking(const std::shared_ptr& texture) const; + // Visible for testing. + DescriptorPoolVK& GetDescriptorPool() const; + private: friend class ContextVK; friend class CommandQueueVK; diff --git a/impeller/renderer/backend/vulkan/descriptor_pool_vk_unittests.cc b/impeller/renderer/backend/vulkan/descriptor_pool_vk_unittests.cc index 2deb9b3453642..fea47418dcdac 100644 --- a/impeller/renderer/backend/vulkan/descriptor_pool_vk_unittests.cc +++ b/impeller/renderer/backend/vulkan/descriptor_pool_vk_unittests.cc @@ -5,6 +5,7 @@ #include "flutter/testing/testing.h" // IWYU pragma: keep. #include "fml/closure.h" #include "fml/synchronization/waitable_event.h" +#include "impeller/renderer/backend/vulkan/command_buffer_vk.h" #include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/resource_manager_vk.h" #include "impeller/renderer/backend/vulkan/test/mock_vulkan.h" @@ -123,5 +124,27 @@ TEST(DescriptorPoolRecyclerVKTest, ReclaimDropsDescriptorPoolIfSizeIsExceeded) { context->Shutdown(); } +TEST(DescriptorPoolRecyclerVKTest, MultipleCommandBuffersShareDescriptorPool) { + auto const context = MockVulkanContextBuilder().Build(); + + auto cmd_buffer_1 = context->CreateCommandBuffer(); + auto cmd_buffer_2 = context->CreateCommandBuffer(); + + CommandBufferVK& vk_1 = CommandBufferVK::Cast(*cmd_buffer_1); + CommandBufferVK& vk_2 = CommandBufferVK::Cast(*cmd_buffer_2); + + EXPECT_EQ(&vk_1.GetDescriptorPool(), &vk_2.GetDescriptorPool()); + + // Resetting resources creates a new pool. + context->DisposeThreadLocalCachedResources(); + + auto cmd_buffer_3 = context->CreateCommandBuffer(); + CommandBufferVK& vk_3 = CommandBufferVK::Cast(*cmd_buffer_3); + + EXPECT_NE(&vk_1.GetDescriptorPool(), &vk_3.GetDescriptorPool()); + + context->Shutdown(); +} + } // namespace testing } // namespace impeller From 8432312dc17b189653d83677bbd97a0ae2bad9c7 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 17 Oct 2024 17:03:32 -0700 Subject: [PATCH 03/11] fix comment. --- impeller/renderer/backend/vulkan/context_vk.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impeller/renderer/backend/vulkan/context_vk.cc b/impeller/renderer/backend/vulkan/context_vk.cc index 46e582a49b7b1..8bb17e9d10ad5 100644 --- a/impeller/renderer/backend/vulkan/context_vk.cc +++ b/impeller/renderer/backend/vulkan/context_vk.cc @@ -490,13 +490,13 @@ std::shared_ptr ContextVK::GetPipelineLibrary() const { return pipeline_library_; } -// DescriptorPool Lifecycle: +// DescriptorPool Lifecycle (Same as CommandPool lifecycle) // 1. End of frame will reset the descriptor pool (clearing this on a thread). // There will still be references to the descriptor pool from the uncompleted // command buffers. // 2. The last reference to the descriptor pool will be released from the fence // waiter thread, which will schedule a task on the resource -// manager thread, which in turn will reset the command pool and make it +// manager thread, which in turn will reset the descriptor pool and make it // available for reuse ("recycle"). static thread_local std::shared_ptr tls_descriptor_pool; From d973b2c1f8c9a1cf512b86e152fa261c051643b7 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 17 Oct 2024 18:22:27 -0700 Subject: [PATCH 04/11] hook into existing TLS storage. --- .../backend/vulkan/command_pool_vk.cc | 87 ++++++++++++++----- .../renderer/backend/vulkan/command_pool_vk.h | 20 +++++ .../renderer/backend/vulkan/context_vk.cc | 19 ++-- impeller/renderer/backend/vulkan/context_vk.h | 2 - .../vulkan/test/mock_vulkan_unittests.cc | 1 + .../backend/vulkan/tracked_objects_vk.cc | 1 + .../backend/vulkan/tracked_objects_vk.h | 2 + 7 files changed, 93 insertions(+), 39 deletions(-) diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.cc b/impeller/renderer/backend/vulkan/command_pool_vk.cc index 9bb3d9d898621..c49dcfadd1e9c 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.cc +++ b/impeller/renderer/backend/vulkan/command_pool_vk.cc @@ -9,6 +9,7 @@ #include #include "impeller/renderer/backend/vulkan/context_vk.h" +#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/resource_manager_vk.h" #include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep. @@ -155,10 +156,6 @@ void CommandPoolVK::Destroy() { collected_buffers_.clear(); } -// Associates a resource with a thread and context. -using CommandPoolMap = - std::unordered_map>; - // CommandPoolVK Lifecycle: // 1. End of frame will reset the command pool (clearing this on a thread). // There will still be references to the command pool from the uncompleted @@ -169,17 +166,47 @@ using CommandPoolMap = // available for reuse ("recycle"). static thread_local std::unique_ptr tls_command_pool_map; +struct WeakThreadLocalData { + std::weak_ptr command_pool; + std::weak_ptr descriptor_pool; +}; + // Map each context to a list of all thread-local command pools associated // with that context. static Mutex g_all_pools_map_mutex; -static std::unordered_map< - const ContextVK*, - std::vector>> g_all_pools_map +static std::unordered_map> g_all_pools_map IPLR_GUARDED_BY(g_all_pools_map_mutex); +std::shared_ptr CommandPoolRecyclerVK::GetDescriptorPool() { + const auto& strong_context = context_.lock(); + if (!strong_context) { + return nullptr; + } + + // If there is a resource in used for this thread and context, return it. + if (!tls_command_pool_map.get()) { + tls_command_pool_map.reset(new CommandPoolMap()); + } + CommandPoolMap& pool_map = *tls_command_pool_map.get(); + auto const hash = strong_context->GetHash(); + auto const it = pool_map.find(hash); + if (it != pool_map.end()) { + return it->second.descriptor_pool; + } + + const auto& result = + InitializeThreadLocalResources(strong_context, pool_map, hash); + if (result.has_value()) { + return result->descriptor_pool; + } + + return nullptr; +} + // TODO(matanlurey): Return a status_or<> instead of nullptr when we have one. std::shared_ptr CommandPoolRecyclerVK::Get() { - auto const strong_context = context_.lock(); + const auto& strong_context = context_.lock(); if (!strong_context) { return nullptr; } @@ -192,25 +219,40 @@ std::shared_ptr CommandPoolRecyclerVK::Get() { auto const hash = strong_context->GetHash(); auto const it = pool_map.find(hash); if (it != pool_map.end()) { - return it->second; + return it->second.command_pool; } - // Otherwise, create a new resource and return it. + const auto& result = + InitializeThreadLocalResources(strong_context, pool_map, hash); + if (result.has_value()) { + return result->command_pool; + } + + return nullptr; +} + +std::optional +CommandPoolRecyclerVK::InitializeThreadLocalResources( + const std::shared_ptr& context, + CommandPoolMap& pool_map, + uint64_t pool_key) { auto data = Create(); if (!data || !data->pool) { - return nullptr; + return std::nullopt; } - auto const resource = std::make_shared( + auto command_pool = std::make_shared( std::move(data->pool), std::move(data->buffers), context_); - pool_map.emplace(hash, resource); - + auto descriptor_pool = std::make_shared(context_); { Lock all_pools_lock(g_all_pools_map_mutex); - g_all_pools_map[strong_context.get()].push_back(resource); + g_all_pools_map[context.get()].push_back(WeakThreadLocalData{ + .command_pool = command_pool, .descriptor_pool = descriptor_pool}); } - return resource; + return pool_map[pool_key] = + ThreadLocalData{.command_pool = std::move(command_pool), + .descriptor_pool = std::move(descriptor_pool)}; } // TODO(matanlurey): Return a status_or<> instead of nullopt when we have one. @@ -293,14 +335,13 @@ void CommandPoolRecyclerVK::DestroyThreadLocalPools(const ContextVK* context) { Lock all_pools_lock(g_all_pools_map_mutex); auto found = g_all_pools_map.find(context); if (found != g_all_pools_map.end()) { - for (auto& weak_pool : found->second) { - auto pool = weak_pool.lock(); - if (!pool) { - continue; + for (auto& [command_pool, desc_pool] : found->second) { + const auto& strong_pool = command_pool.lock(); + if (strong_pool) { + // Delete all objects held by this pool. The destroyed pool will still + // remain in its thread's TLS map until that thread exits. + strong_pool->Destroy(); } - // Delete all objects held by this pool. The destroyed pool will still - // remain in its thread's TLS map until that thread exits. - pool->Destroy(); } g_all_pools_map.erase(found); } diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.h b/impeller/renderer/backend/vulkan/command_pool_vk.h index dd60026b44f70..662d03422416f 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.h +++ b/impeller/renderer/backend/vulkan/command_pool_vk.h @@ -10,6 +10,7 @@ #include #include "impeller/base/thread.h" +#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep. #include "vulkan/vulkan_handles.hpp" @@ -76,6 +77,15 @@ class CommandPoolVK final { pool_mutex_); }; +struct ThreadLocalData { + std::shared_ptr command_pool; + std::shared_ptr descriptor_pool; +}; + +// Associates a resource with a thread and context. +using CommandPoolMap = + std::unordered_map; + //------------------------------------------------------------------------------ /// @brief Creates and manages the lifecycle of |vk::CommandPool| objects. /// @@ -128,6 +138,11 @@ class CommandPoolRecyclerVK final /// @warning Returns a |nullptr| if a pool could not be created. std::shared_ptr Get(); + /// @brief Gets a descriptor pool for the current thread. + /// + /// @warning Returns a |nullptr| if a pool could not be created. + std::shared_ptr GetDescriptorPool(); + /// @brief Returns a command pool to be reset on a background thread. /// /// @param[in] pool The pool to recycler. @@ -153,6 +168,11 @@ class CommandPoolRecyclerVK final /// @returns Returns a |std::nullopt| if a pool was not available. std::optional Reuse(); + /// Create a DescriptorPoolVK and a CommandPoolVK and stash them in the TLS + /// map. + std::optional InitializeThreadLocalResources( + const std::shared_ptr& context, CommandPoolMap& pool_map, uint64_t pool_key); + CommandPoolRecyclerVK(const CommandPoolRecyclerVK&) = delete; CommandPoolRecyclerVK& operator=(const CommandPoolRecyclerVK&) = delete; diff --git a/impeller/renderer/backend/vulkan/context_vk.cc b/impeller/renderer/backend/vulkan/context_vk.cc index 8bb17e9d10ad5..9ce57fa19af36 100644 --- a/impeller/renderer/backend/vulkan/context_vk.cc +++ b/impeller/renderer/backend/vulkan/context_vk.cc @@ -490,27 +490,19 @@ std::shared_ptr ContextVK::GetPipelineLibrary() const { return pipeline_library_; } -// DescriptorPool Lifecycle (Same as CommandPool lifecycle) -// 1. End of frame will reset the descriptor pool (clearing this on a thread). -// There will still be references to the descriptor pool from the uncompleted -// command buffers. -// 2. The last reference to the descriptor pool will be released from the fence -// waiter thread, which will schedule a task on the resource -// manager thread, which in turn will reset the descriptor pool and make it -// available for reuse ("recycle"). -static thread_local std::shared_ptr tls_descriptor_pool; - std::shared_ptr ContextVK::CreateCommandBuffer() const { const auto& recycler = GetCommandPoolRecycler(); auto tls_pool = recycler->Get(); if (!tls_pool) { return nullptr; } - if (!tls_descriptor_pool) { - tls_descriptor_pool = std::make_shared(weak_from_this()); + auto tls_desc_pool = recycler->GetDescriptorPool(); + if (!tls_desc_pool) { + return nullptr; } + auto tracked_objects = std::make_shared( - weak_from_this(), std::move(tls_pool), tls_descriptor_pool, + weak_from_this(), std::move(tls_pool), tls_desc_pool, GetGPUTracer()->CreateGPUProbe()); auto queue = GetGraphicsQueue(); @@ -644,7 +636,6 @@ void ContextVK::InitializeCommonlyUsedShadersIfNeeded() const { void ContextVK::DisposeThreadLocalCachedResources() { command_pool_recycler_->Dispose(); - tls_descriptor_pool.reset(); } const std::shared_ptr& diff --git a/impeller/renderer/backend/vulkan/context_vk.h b/impeller/renderer/backend/vulkan/context_vk.h index fe7f4da002f91..5e7f134fab10a 100644 --- a/impeller/renderer/backend/vulkan/context_vk.h +++ b/impeller/renderer/backend/vulkan/context_vk.h @@ -10,10 +10,8 @@ #include "flutter/fml/concurrent_message_loop.h" #include "flutter/fml/mapping.h" #include "flutter/fml/unique_fd.h" -#include "fml/thread.h" #include "impeller/base/backend_cast.h" #include "impeller/core/formats.h" -#include "impeller/renderer/backend/vulkan/command_pool_vk.h" #include "impeller/renderer/backend/vulkan/device_holder_vk.h" #include "impeller/renderer/backend/vulkan/driver_info_vk.h" #include "impeller/renderer/backend/vulkan/pipeline_library_vk.h" diff --git a/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc b/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc index 2555994a8fd03..092e7c7da7e8f 100644 --- a/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc +++ b/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc @@ -5,6 +5,7 @@ #include "flutter/testing/testing.h" // IWYU pragma: keep #include "gtest/gtest.h" #include "impeller/renderer/backend/vulkan/test/mock_vulkan.h" +#include "impeller/renderer/backend/vulkan/command_pool_vk.h" #include "vulkan/vulkan_enums.hpp" namespace impeller { diff --git a/impeller/renderer/backend/vulkan/tracked_objects_vk.cc b/impeller/renderer/backend/vulkan/tracked_objects_vk.cc index 4bbaf94319d8c..249d2483b01b9 100644 --- a/impeller/renderer/backend/vulkan/tracked_objects_vk.cc +++ b/impeller/renderer/backend/vulkan/tracked_objects_vk.cc @@ -4,6 +4,7 @@ #include "impeller/renderer/backend/vulkan/tracked_objects_vk.h" +#include "impeller/renderer/backend/vulkan/command_pool_vk.h" #include "impeller/renderer/backend/vulkan/gpu_tracer_vk.h" namespace impeller { diff --git a/impeller/renderer/backend/vulkan/tracked_objects_vk.h b/impeller/renderer/backend/vulkan/tracked_objects_vk.h index 8305f51160380..4ac72bc886e43 100644 --- a/impeller/renderer/backend/vulkan/tracked_objects_vk.h +++ b/impeller/renderer/backend/vulkan/tracked_objects_vk.h @@ -14,6 +14,8 @@ namespace impeller { +class CommandPoolVK; + /// @brief A per-frame object used to track resource lifetimes and allocate /// command buffers and descriptor sets. class TrackedObjectsVK { From 0ae06a820834aa1722b4ee3b12e28368cd2c7e16 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 17 Oct 2024 18:22:49 -0700 Subject: [PATCH 05/11] ++ --- impeller/renderer/backend/vulkan/surface_context_vk.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impeller/renderer/backend/vulkan/surface_context_vk.cc b/impeller/renderer/backend/vulkan/surface_context_vk.cc index b5ddd61a04e01..912c74b03c056 100644 --- a/impeller/renderer/backend/vulkan/surface_context_vk.cc +++ b/impeller/renderer/backend/vulkan/surface_context_vk.cc @@ -86,7 +86,7 @@ std::unique_ptr SurfaceContextVK::AcquireNextSurface() { impeller::PipelineLibraryVK::Cast(*pipeline_library) .DidAcquireSurfaceFrame(); } - DisposeThreadLocalCachedResources(); + parent_->GetCommandPoolRecycler()->Dispose(); parent_->GetResourceAllocator()->DebugTraceMemoryStatistics(); return surface; } From a7398b93d0a263a56a23da5761eb037f570d2134 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 17 Oct 2024 18:24:55 -0700 Subject: [PATCH 06/11] ++ --- impeller/renderer/backend/vulkan/command_pool_vk.h | 7 ++++--- .../renderer/backend/vulkan/test/mock_vulkan_unittests.cc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.h b/impeller/renderer/backend/vulkan/command_pool_vk.h index 662d03422416f..55fec9b35137c 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.h +++ b/impeller/renderer/backend/vulkan/command_pool_vk.h @@ -83,8 +83,7 @@ struct ThreadLocalData { }; // Associates a resource with a thread and context. -using CommandPoolMap = - std::unordered_map; +using CommandPoolMap = std::unordered_map; //------------------------------------------------------------------------------ /// @brief Creates and manages the lifecycle of |vk::CommandPool| objects. @@ -171,7 +170,9 @@ class CommandPoolRecyclerVK final /// Create a DescriptorPoolVK and a CommandPoolVK and stash them in the TLS /// map. std::optional InitializeThreadLocalResources( - const std::shared_ptr& context, CommandPoolMap& pool_map, uint64_t pool_key); + const std::shared_ptr& context, + CommandPoolMap& pool_map, + uint64_t pool_key); CommandPoolRecyclerVK(const CommandPoolRecyclerVK&) = delete; diff --git a/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc b/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc index 092e7c7da7e8f..1688b12e49c46 100644 --- a/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc +++ b/impeller/renderer/backend/vulkan/test/mock_vulkan_unittests.cc @@ -4,8 +4,8 @@ #include "flutter/testing/testing.h" // IWYU pragma: keep #include "gtest/gtest.h" -#include "impeller/renderer/backend/vulkan/test/mock_vulkan.h" #include "impeller/renderer/backend/vulkan/command_pool_vk.h" +#include "impeller/renderer/backend/vulkan/test/mock_vulkan.h" #include "vulkan/vulkan_enums.hpp" namespace impeller { From 29c9dce790539bb619507a1aa48056a67fbabb15 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Fri, 18 Oct 2024 13:33:09 -0700 Subject: [PATCH 07/11] ++ --- impeller/renderer/backend/vulkan/command_pool_vk.cc | 6 +++++- impeller/renderer/backend/vulkan/descriptor_pool_vk.cc | 4 ++++ impeller/renderer/backend/vulkan/descriptor_pool_vk.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.cc b/impeller/renderer/backend/vulkan/command_pool_vk.cc index c49dcfadd1e9c..e0357577ce9c8 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.cc +++ b/impeller/renderer/backend/vulkan/command_pool_vk.cc @@ -336,12 +336,16 @@ void CommandPoolRecyclerVK::DestroyThreadLocalPools(const ContextVK* context) { auto found = g_all_pools_map.find(context); if (found != g_all_pools_map.end()) { for (auto& [command_pool, desc_pool] : found->second) { - const auto& strong_pool = command_pool.lock(); + const auto strong_pool = command_pool.lock(); if (strong_pool) { // Delete all objects held by this pool. The destroyed pool will still // remain in its thread's TLS map until that thread exits. strong_pool->Destroy(); } + const auto strong_desc_pool = desc_pool.lock(); + if (strong_desc_pool) { + strong_pool->Destroy(); + } } g_all_pools_map.erase(found); } diff --git a/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc b/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc index c7545ea9a156d..a6b24b64cbbb4 100644 --- a/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc +++ b/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc @@ -91,6 +91,10 @@ DescriptorPoolVK::~DescriptorPoolVK() { pools_.clear(); } +void DescriptorPoolVK::Destroy() { + pools_.clear(); +} + fml::StatusOr DescriptorPoolVK::AllocateDescriptorSets( const vk::DescriptorSetLayout& layout, const ContextVK& context_vk) { diff --git a/impeller/renderer/backend/vulkan/descriptor_pool_vk.h b/impeller/renderer/backend/vulkan/descriptor_pool_vk.h index 53f35a94ab890..ef4ac23553e14 100644 --- a/impeller/renderer/backend/vulkan/descriptor_pool_vk.h +++ b/impeller/renderer/backend/vulkan/descriptor_pool_vk.h @@ -34,6 +34,8 @@ class DescriptorPoolVK { const vk::DescriptorSetLayout& layout, const ContextVK& context_vk); + void Destroy(); + private: std::weak_ptr context_; std::vector pools_; From f5efff60a826454b02ac74b69776e43aad819798 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Fri, 18 Oct 2024 14:09:43 -0700 Subject: [PATCH 08/11] ++ --- .../backend/vulkan/command_pool_vk.cc | 19 +++++-------------- impeller/renderer/backend/vulkan/context_vk.h | 2 +- .../backend/vulkan/descriptor_pool_vk.cc | 4 ---- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.cc b/impeller/renderer/backend/vulkan/command_pool_vk.cc index e0357577ce9c8..7d46e00aa93b9 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.cc +++ b/impeller/renderer/backend/vulkan/command_pool_vk.cc @@ -166,16 +166,12 @@ void CommandPoolVK::Destroy() { // available for reuse ("recycle"). static thread_local std::unique_ptr tls_command_pool_map; -struct WeakThreadLocalData { - std::weak_ptr command_pool; - std::weak_ptr descriptor_pool; -}; - // Map each context to a list of all thread-local command pools associated // with that context. static Mutex g_all_pools_map_mutex; -static std::unordered_map> g_all_pools_map +static std::unordered_map< + const ContextVK*, + std::vector>> g_all_pools_map IPLR_GUARDED_BY(g_all_pools_map_mutex); std::shared_ptr CommandPoolRecyclerVK::GetDescriptorPool() { @@ -246,8 +242,7 @@ CommandPoolRecyclerVK::InitializeThreadLocalResources( auto descriptor_pool = std::make_shared(context_); { Lock all_pools_lock(g_all_pools_map_mutex); - g_all_pools_map[context.get()].push_back(WeakThreadLocalData{ - .command_pool = command_pool, .descriptor_pool = descriptor_pool}); + g_all_pools_map[context.get()].push_back(command_pool); } return pool_map[pool_key] = @@ -335,17 +330,13 @@ void CommandPoolRecyclerVK::DestroyThreadLocalPools(const ContextVK* context) { Lock all_pools_lock(g_all_pools_map_mutex); auto found = g_all_pools_map.find(context); if (found != g_all_pools_map.end()) { - for (auto& [command_pool, desc_pool] : found->second) { + for (auto& command_pool : found->second) { const auto strong_pool = command_pool.lock(); if (strong_pool) { // Delete all objects held by this pool. The destroyed pool will still // remain in its thread's TLS map until that thread exits. strong_pool->Destroy(); } - const auto strong_desc_pool = desc_pool.lock(); - if (strong_desc_pool) { - strong_pool->Destroy(); - } } g_all_pools_map.erase(found); } diff --git a/impeller/renderer/backend/vulkan/context_vk.h b/impeller/renderer/backend/vulkan/context_vk.h index 5e7f134fab10a..abd8811b7ba65 100644 --- a/impeller/renderer/backend/vulkan/context_vk.h +++ b/impeller/renderer/backend/vulkan/context_vk.h @@ -201,11 +201,11 @@ class ContextVK final : public Context, std::shared_ptr device_capabilities_; std::shared_ptr fence_waiter_; std::shared_ptr resource_manager_; + std::shared_ptr descriptor_pool_recycler_; std::shared_ptr command_pool_recycler_; std::string device_name_; std::shared_ptr raster_message_loop_; std::shared_ptr gpu_tracer_; - std::shared_ptr descriptor_pool_recycler_; std::shared_ptr command_queue_vk_; bool should_disable_surface_control_ = false; diff --git a/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc b/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc index a6b24b64cbbb4..c7545ea9a156d 100644 --- a/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc +++ b/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc @@ -91,10 +91,6 @@ DescriptorPoolVK::~DescriptorPoolVK() { pools_.clear(); } -void DescriptorPoolVK::Destroy() { - pools_.clear(); -} - fml::StatusOr DescriptorPoolVK::AllocateDescriptorSets( const vk::DescriptorSetLayout& layout, const ContextVK& context_vk) { From 441daf5f47ccc5dbafdd8d5f85c3b0523d32a48a Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Fri, 18 Oct 2024 23:01:27 -0700 Subject: [PATCH 09/11] ++ --- .ci.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index 205edfe43306c..64234fe4970d2 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -85,14 +85,14 @@ targets: {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] timeout: 90 - runIf: - - .ci.yaml - - ci/builders/linux_android_emulator.json - - DEPS - - lib/ui/** - - shell/platform/android/** - - testing/scenario_app/** - - testing/skia_gold_client/** + # runIf: + # - .ci.yaml + # - ci/builders/linux_android_emulator.json + # - DEPS + # - lib/ui/** + # - shell/platform/android/** + # - testing/scenario_app/** + # - testing/skia_gold_client/** - name: Linux linux_android_emulator_opengles_tests_34 enabled_branches: From 1262955eae72cb73d623bdeeac597e8daed5d1d2 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sun, 20 Oct 2024 10:48:00 -0700 Subject: [PATCH 10/11] move to its own map --- .../backend/vulkan/command_pool_vk.cc | 76 +++++-------------- .../renderer/backend/vulkan/command_pool_vk.h | 21 ----- .../renderer/backend/vulkan/context_vk.cc | 21 ++++- impeller/renderer/backend/vulkan/context_vk.h | 7 ++ .../backend/vulkan/descriptor_pool_vk.h | 2 - .../backend/vulkan/surface_context_vk.cc | 2 +- .../backend/vulkan/tracked_objects_vk.h | 2 - 7 files changed, 45 insertions(+), 86 deletions(-) diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.cc b/impeller/renderer/backend/vulkan/command_pool_vk.cc index 7d46e00aa93b9..9bb3d9d898621 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.cc +++ b/impeller/renderer/backend/vulkan/command_pool_vk.cc @@ -9,7 +9,6 @@ #include #include "impeller/renderer/backend/vulkan/context_vk.h" -#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/resource_manager_vk.h" #include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep. @@ -156,6 +155,10 @@ void CommandPoolVK::Destroy() { collected_buffers_.clear(); } +// Associates a resource with a thread and context. +using CommandPoolMap = + std::unordered_map>; + // CommandPoolVK Lifecycle: // 1. End of frame will reset the command pool (clearing this on a thread). // There will still be references to the command pool from the uncompleted @@ -174,35 +177,9 @@ static std::unordered_map< std::vector>> g_all_pools_map IPLR_GUARDED_BY(g_all_pools_map_mutex); -std::shared_ptr CommandPoolRecyclerVK::GetDescriptorPool() { - const auto& strong_context = context_.lock(); - if (!strong_context) { - return nullptr; - } - - // If there is a resource in used for this thread and context, return it. - if (!tls_command_pool_map.get()) { - tls_command_pool_map.reset(new CommandPoolMap()); - } - CommandPoolMap& pool_map = *tls_command_pool_map.get(); - auto const hash = strong_context->GetHash(); - auto const it = pool_map.find(hash); - if (it != pool_map.end()) { - return it->second.descriptor_pool; - } - - const auto& result = - InitializeThreadLocalResources(strong_context, pool_map, hash); - if (result.has_value()) { - return result->descriptor_pool; - } - - return nullptr; -} - // TODO(matanlurey): Return a status_or<> instead of nullptr when we have one. std::shared_ptr CommandPoolRecyclerVK::Get() { - const auto& strong_context = context_.lock(); + auto const strong_context = context_.lock(); if (!strong_context) { return nullptr; } @@ -215,39 +192,25 @@ std::shared_ptr CommandPoolRecyclerVK::Get() { auto const hash = strong_context->GetHash(); auto const it = pool_map.find(hash); if (it != pool_map.end()) { - return it->second.command_pool; + return it->second; } - const auto& result = - InitializeThreadLocalResources(strong_context, pool_map, hash); - if (result.has_value()) { - return result->command_pool; - } - - return nullptr; -} - -std::optional -CommandPoolRecyclerVK::InitializeThreadLocalResources( - const std::shared_ptr& context, - CommandPoolMap& pool_map, - uint64_t pool_key) { + // Otherwise, create a new resource and return it. auto data = Create(); if (!data || !data->pool) { - return std::nullopt; + return nullptr; } - auto command_pool = std::make_shared( + auto const resource = std::make_shared( std::move(data->pool), std::move(data->buffers), context_); - auto descriptor_pool = std::make_shared(context_); + pool_map.emplace(hash, resource); + { Lock all_pools_lock(g_all_pools_map_mutex); - g_all_pools_map[context.get()].push_back(command_pool); + g_all_pools_map[strong_context.get()].push_back(resource); } - return pool_map[pool_key] = - ThreadLocalData{.command_pool = std::move(command_pool), - .descriptor_pool = std::move(descriptor_pool)}; + return resource; } // TODO(matanlurey): Return a status_or<> instead of nullopt when we have one. @@ -330,13 +293,14 @@ void CommandPoolRecyclerVK::DestroyThreadLocalPools(const ContextVK* context) { Lock all_pools_lock(g_all_pools_map_mutex); auto found = g_all_pools_map.find(context); if (found != g_all_pools_map.end()) { - for (auto& command_pool : found->second) { - const auto strong_pool = command_pool.lock(); - if (strong_pool) { - // Delete all objects held by this pool. The destroyed pool will still - // remain in its thread's TLS map until that thread exits. - strong_pool->Destroy(); + for (auto& weak_pool : found->second) { + auto pool = weak_pool.lock(); + if (!pool) { + continue; } + // Delete all objects held by this pool. The destroyed pool will still + // remain in its thread's TLS map until that thread exits. + pool->Destroy(); } g_all_pools_map.erase(found); } diff --git a/impeller/renderer/backend/vulkan/command_pool_vk.h b/impeller/renderer/backend/vulkan/command_pool_vk.h index 55fec9b35137c..dd60026b44f70 100644 --- a/impeller/renderer/backend/vulkan/command_pool_vk.h +++ b/impeller/renderer/backend/vulkan/command_pool_vk.h @@ -10,7 +10,6 @@ #include #include "impeller/base/thread.h" -#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep. #include "vulkan/vulkan_handles.hpp" @@ -77,14 +76,6 @@ class CommandPoolVK final { pool_mutex_); }; -struct ThreadLocalData { - std::shared_ptr command_pool; - std::shared_ptr descriptor_pool; -}; - -// Associates a resource with a thread and context. -using CommandPoolMap = std::unordered_map; - //------------------------------------------------------------------------------ /// @brief Creates and manages the lifecycle of |vk::CommandPool| objects. /// @@ -137,11 +128,6 @@ class CommandPoolRecyclerVK final /// @warning Returns a |nullptr| if a pool could not be created. std::shared_ptr Get(); - /// @brief Gets a descriptor pool for the current thread. - /// - /// @warning Returns a |nullptr| if a pool could not be created. - std::shared_ptr GetDescriptorPool(); - /// @brief Returns a command pool to be reset on a background thread. /// /// @param[in] pool The pool to recycler. @@ -167,13 +153,6 @@ class CommandPoolRecyclerVK final /// @returns Returns a |std::nullopt| if a pool was not available. std::optional Reuse(); - /// Create a DescriptorPoolVK and a CommandPoolVK and stash them in the TLS - /// map. - std::optional InitializeThreadLocalResources( - const std::shared_ptr& context, - CommandPoolMap& pool_map, - uint64_t pool_key); - CommandPoolRecyclerVK(const CommandPoolRecyclerVK&) = delete; CommandPoolRecyclerVK& operator=(const CommandPoolRecyclerVK&) = delete; diff --git a/impeller/renderer/backend/vulkan/context_vk.cc b/impeller/renderer/backend/vulkan/context_vk.cc index 9ce57fa19af36..d2092bb961d29 100644 --- a/impeller/renderer/backend/vulkan/context_vk.cc +++ b/impeller/renderer/backend/vulkan/context_vk.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. #include "impeller/renderer/backend/vulkan/context_vk.h" +#include +#include #include "fml/concurrent_message_loop.h" #include "impeller/renderer/backend/vulkan/command_queue_vk.h" @@ -31,6 +33,7 @@ #include "impeller/renderer/backend/vulkan/command_pool_vk.h" #include "impeller/renderer/backend/vulkan/command_queue_vk.h" #include "impeller/renderer/backend/vulkan/debug_report_vk.h" +#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h" #include "impeller/renderer/backend/vulkan/fence_waiter_vk.h" #include "impeller/renderer/backend/vulkan/gpu_tracer_vk.h" #include "impeller/renderer/backend/vulkan/resource_manager_vk.h" @@ -496,13 +499,22 @@ std::shared_ptr ContextVK::CreateCommandBuffer() const { if (!tls_pool) { return nullptr; } - auto tls_desc_pool = recycler->GetDescriptorPool(); - if (!tls_desc_pool) { - return nullptr; + + // look up a cached descriptor pool for the current frame and reuse it + // if it exists, otherwise create a new pool. + DescriptorPoolMap::iterator current_pool = + cached_descriptor_pool_.find(std::this_thread::get_id()); + std::shared_ptr descriptor_pool; + if (current_pool == cached_descriptor_pool_.end()) { + descriptor_pool = + (cached_descriptor_pool_[std::this_thread::get_id()] = + std::make_shared(weak_from_this())); + } else { + descriptor_pool = current_pool->second; } auto tracked_objects = std::make_shared( - weak_from_this(), std::move(tls_pool), tls_desc_pool, + weak_from_this(), std::move(tls_pool), std::move(descriptor_pool), GetGPUTracer()->CreateGPUProbe()); auto queue = GetGraphicsQueue(); @@ -635,6 +647,7 @@ void ContextVK::InitializeCommonlyUsedShadersIfNeeded() const { } void ContextVK::DisposeThreadLocalCachedResources() { + cached_descriptor_pool_.erase(std::this_thread::get_id()); command_pool_recycler_->Dispose(); } diff --git a/impeller/renderer/backend/vulkan/context_vk.h b/impeller/renderer/backend/vulkan/context_vk.h index abd8811b7ba65..c6ccc280bc147 100644 --- a/impeller/renderer/backend/vulkan/context_vk.h +++ b/impeller/renderer/backend/vulkan/context_vk.h @@ -12,6 +12,7 @@ #include "flutter/fml/unique_fd.h" #include "impeller/base/backend_cast.h" #include "impeller/core/formats.h" +#include "impeller/renderer/backend/vulkan/command_pool_vk.h" #include "impeller/renderer/backend/vulkan/device_holder_vk.h" #include "impeller/renderer/backend/vulkan/driver_info_vk.h" #include "impeller/renderer/backend/vulkan/pipeline_library_vk.h" @@ -36,6 +37,7 @@ class SurfaceContextVK; class GPUTracerVK; class DescriptorPoolRecyclerVK; class CommandQueueVK; +class DescriptorPoolVK; class ContextVK final : public Context, public BackendCast, @@ -207,6 +209,11 @@ class ContextVK final : public Context, std::shared_ptr raster_message_loop_; std::shared_ptr gpu_tracer_; std::shared_ptr command_queue_vk_; + + using DescriptorPoolMap = + std::unordered_map>; + + mutable DescriptorPoolMap cached_descriptor_pool_; bool should_disable_surface_control_ = false; const uint64_t hash_; diff --git a/impeller/renderer/backend/vulkan/descriptor_pool_vk.h b/impeller/renderer/backend/vulkan/descriptor_pool_vk.h index ef4ac23553e14..53f35a94ab890 100644 --- a/impeller/renderer/backend/vulkan/descriptor_pool_vk.h +++ b/impeller/renderer/backend/vulkan/descriptor_pool_vk.h @@ -34,8 +34,6 @@ class DescriptorPoolVK { const vk::DescriptorSetLayout& layout, const ContextVK& context_vk); - void Destroy(); - private: std::weak_ptr context_; std::vector pools_; diff --git a/impeller/renderer/backend/vulkan/surface_context_vk.cc b/impeller/renderer/backend/vulkan/surface_context_vk.cc index 912c74b03c056..dd1708c8f266d 100644 --- a/impeller/renderer/backend/vulkan/surface_context_vk.cc +++ b/impeller/renderer/backend/vulkan/surface_context_vk.cc @@ -86,7 +86,7 @@ std::unique_ptr SurfaceContextVK::AcquireNextSurface() { impeller::PipelineLibraryVK::Cast(*pipeline_library) .DidAcquireSurfaceFrame(); } - parent_->GetCommandPoolRecycler()->Dispose(); + parent_->DisposeThreadLocalCachedResources(); parent_->GetResourceAllocator()->DebugTraceMemoryStatistics(); return surface; } diff --git a/impeller/renderer/backend/vulkan/tracked_objects_vk.h b/impeller/renderer/backend/vulkan/tracked_objects_vk.h index 4ac72bc886e43..8305f51160380 100644 --- a/impeller/renderer/backend/vulkan/tracked_objects_vk.h +++ b/impeller/renderer/backend/vulkan/tracked_objects_vk.h @@ -14,8 +14,6 @@ namespace impeller { -class CommandPoolVK; - /// @brief A per-frame object used to track resource lifetimes and allocate /// command buffers and descriptor sets. class TrackedObjectsVK { From 988694f98ca59874b6b189d3227e32278ad971c5 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 21 Oct 2024 11:20:10 -0700 Subject: [PATCH 11/11] Revert ci yaml --- .ci.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index 64234fe4970d2..239cce546881e 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -85,14 +85,14 @@ targets: {"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"} ] timeout: 90 - # runIf: - # - .ci.yaml - # - ci/builders/linux_android_emulator.json - # - DEPS - # - lib/ui/** - # - shell/platform/android/** - # - testing/scenario_app/** - # - testing/skia_gold_client/** + runIf: + - .ci.yaml + - ci/builders/linux_android_emulator.json + - DEPS + - lib/ui/** + - shell/platform/android/** + - testing/scenario_app/** + - testing/skia_gold_client/** - name: Linux linux_android_emulator_opengles_tests_34 enabled_branches: @@ -506,6 +506,7 @@ targets: # Avoid using a Mac orchestrator to save ~5 minutes of Mac host time. - name: Linux mac_clangd recipe: engine_v2/engine_v2 + timeout: 90 # Do not remove(https://github.com/flutter/flutter/issues/144644) # Scheduler will fail to get the platform drone_dimensions: