From 8984c33e26479d7cefc800062cee664ab1ef0842 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Tue, 10 Dec 2024 09:39:38 -0800 Subject: [PATCH] [Impeller] wait idle during shader hot reload. --- impeller/entity/contents/content_context.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index b3cc2d9932585..b6e0791b4e52c 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -585,6 +585,11 @@ ContentContext::GetCachedRuntimeEffectPipeline( void ContentContext::ClearCachedRuntimeEffectPipeline( const std::string& unique_entrypoint_name) const { + // Pipelines may be in use by the GPU when a host reload/restart is + // performed. This wait idle ensures that all pending commands have + // completed before any pipelines are destroyed. + GetContext()->GetIdleWaiter()->WaitIdle(); + for (auto it = runtime_effect_pipelines_.begin(); it != runtime_effect_pipelines_.end();) { if (it->first.unique_entrypoint_name == unique_entrypoint_name) {