From 626d0d392976cd24169d3b88d5902002ea048691 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 12 Dec 2022 13:25:24 -0800 Subject: [PATCH] [Impeller] Speculatively attempt to fix Metal PSO construction errors on host targets. Fixes https://github.com/flutter/flutter/issues/114872 (speculatively) Following up in https://github.com/flutter/flutter/issues/116919. --- .../backend/metal/pipeline_library_mtl.mm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/impeller/renderer/backend/metal/pipeline_library_mtl.mm b/impeller/renderer/backend/metal/pipeline_library_mtl.mm index 85272ef16fad5..eb220f4f0ff39 100644 --- a/impeller/renderer/backend/metal/pipeline_library_mtl.mm +++ b/impeller/renderer/backend/metal/pipeline_library_mtl.mm @@ -3,8 +3,10 @@ // found in the LICENSE file. #include "impeller/renderer/backend/metal/pipeline_library_mtl.h" + #include +#include "flutter/fml/build_config.h" #include "flutter/fml/container.h" #include "impeller/base/promise.h" #include "impeller/renderer/backend/metal/compute_pipeline_mtl.h" @@ -131,9 +133,19 @@ )); promise->set_value(new_pipeline); }; - [device_ newRenderPipelineStateWithDescriptor:GetMTLRenderPipelineDescriptor( - descriptor) + auto mtl_descriptor = GetMTLRenderPipelineDescriptor(descriptor); +#if FML_OS_IOS + [device_ newRenderPipelineStateWithDescriptor:mtl_descriptor completionHandler:completion_handler]; +#else // FML_OS_IOS + // TODO(116919): Investigate and revert speculative fix to make MTL pipeline + // state creation use a worker. + NSError* error = nil; + auto render_pipeline_state = + [device_ newRenderPipelineStateWithDescriptor:mtl_descriptor + error:&error]; + completion_handler(render_pipeline_state, error); +#endif // FML_OS_IOS return pipeline_future; }