[Impeller] Fix cmd pool reset from background thread. (flutter/engine#47184)
Make sure to clear the buffers before assigning to the recycler, as the dtor was racing with the raster thread usage.
This commit is contained in:
@@ -40,6 +40,7 @@ class BackgroundCommandPoolVK final {
|
||||
if (!recycler) {
|
||||
return;
|
||||
}
|
||||
buffers_.clear();
|
||||
|
||||
recycler->Reclaim(std::move(pool_));
|
||||
}
|
||||
@@ -56,8 +57,6 @@ class BackgroundCommandPoolVK final {
|
||||
std::weak_ptr<CommandPoolRecyclerVK> recycler_;
|
||||
};
|
||||
|
||||
static bool kResetOnBackgroundThread = false;
|
||||
|
||||
CommandPoolVK::~CommandPoolVK() {
|
||||
if (!pool_) {
|
||||
return;
|
||||
@@ -75,10 +74,8 @@ CommandPoolVK::~CommandPoolVK() {
|
||||
auto reset_pool_when_dropped = BackgroundCommandPoolVK(
|
||||
std::move(pool_), std::move(collected_buffers_), recycler);
|
||||
|
||||
if (kResetOnBackgroundThread) {
|
||||
UniqueResourceVKT<BackgroundCommandPoolVK> pool(
|
||||
context->GetResourceManager(), std::move(reset_pool_when_dropped));
|
||||
}
|
||||
UniqueResourceVKT<BackgroundCommandPoolVK> pool(
|
||||
context->GetResourceManager(), std::move(reset_pool_when_dropped));
|
||||
}
|
||||
|
||||
// TODO(matanlurey): Return a status_or<> instead of {} when we have one.
|
||||
|
||||
Reference in New Issue
Block a user