Skip to content

Commit 1128ff7

Browse files
jason-simmonsmboetger
authored andcommitted
Release thread-local resources when submitting a Flutter GPU command buffer (flutter#173663)
Impeller back ends may hold resources (such as Vulkan command pools) in thread-local storage so they can be reused during a series of operations. These resources must be freed when they are no longer useful. Fixes flutter#172068
1 parent a0af764 commit 1128ff7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

engine/src/flutter/lib/gpu/command_buffer.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ bool CommandBuffer::Submit(
5353
encodable->EncodeCommands();
5454
}
5555

56-
context->GetCommandQueue()
57-
->Submit({command_buffer}, completion_callback)
58-
.ok();
56+
context->GetCommandQueue()->Submit({command_buffer},
57+
completion_callback);
58+
context->DisposeThreadLocalCachedResources();
5959
}));
6060
return true;
6161
}
@@ -64,9 +64,10 @@ bool CommandBuffer::Submit(
6464
encodable->EncodeCommands();
6565
}
6666

67-
return context_->GetCommandQueue()
68-
->Submit({command_buffer_}, completion_callback)
69-
.ok();
67+
auto status = context_->GetCommandQueue()->Submit({command_buffer_},
68+
completion_callback);
69+
context_->DisposeThreadLocalCachedResources();
70+
return status.ok();
7071
}
7172

7273
} // namespace gpu

0 commit comments

Comments
 (0)