Repository: flutter
Issue: [iOS] Crash at `impeller::CommandBufferMTL::OnCreateRenderPass(impeller::RenderTarget)`
Labels: c: crash,platform-ios,engine,a: production,P2,needs repro info,e: impeller,team-engine,triaged-engine

### Steps to reproduce

Unfortunately we couldn't reproduce

### Expected results

No crash.

### Actual results

Crash.

### Code sample

<details open><summary>Code sample</summary>

```dart
[Paste your code here]
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

<img width="569" alt="Screenshot 2024-07-01 at 8 51 50 AM" src="https://github.com/flutter/flutter/assets/74494959/9c694648-f34f-42cb-a7b2-b0d50f1745d8">


</details>


### Logs

<details open><summary>Logs</summary>

```console
Crashed: io.flutter.1.raster
0  AGXMetalA12                    0x51bb4 AGX::DataBufferAllocator<32ul>::newCommand() + 276
1  AGXMetalA12                    0x1106ec AGX::RenderContext<AGX::G11::Encoders, AGX::G11::Classes, AGX::G11::ObjClasses>::beginRenderPass() + 264
2  AGXMetalA12                    0x1106ec AGX::RenderContext<AGX::G11::Encoders, AGX::G11::Classes, AGX::G11::ObjClasses>::beginRenderPass() + 264
3  AGXMetalA12                    0x12363c -[AGXA12FamilyRenderContext initWithCommandBuffer:descriptor:subEncoderIndex:framebuffer:] + 6792
4  AGXMetalA12                    0x46218 -[AGXA12FamilyCommandBuffer renderCommandEncoderWithDescriptor:] + 152
5  Flutter                        0x52ec24 impeller::CommandBufferMTL::OnCreateRenderPass(impeller::RenderTarget) + 147 (render_pass_mtl.mm:147)
6  Flutter                        0x36b8dc impeller::CommandBuffer::CreateRenderPass(impeller::RenderTarget const&) + 21 (render_target.cc:21)
7  Flutter                        0x4edf7c impeller::ContentContext::MakeSubpass(std::_fl::basic_string<char, std::_fl::char_traits<char>, std::_fl::allocator<char>> const&, impeller::RenderTarget const&, std::_fl::function<bool (impeller::ContentContext const&, impeller::RenderPass&)> const&) const + 801 (shared_ptr.h:801)
8  Flutter                        0x4f953c impeller::(anonymous namespace)::MakeBlurSubpass(impeller::ContentContext const&, impeller::RenderTarget const&, impeller::SamplerDescriptor const&, impeller::Entity::TileMode, impeller::BlurParameters const&, std::_fl::optional<impeller::RenderTarget>, std::_fl::array<impeller::TPoint<float>, 4ul> const&) + 186 (gaussian_blur_filter_contents.cc:186)
9  Flutter                        0x4f90cc impeller::GaussianBlurFilterContents::RenderFilter(std::_fl::vector<std::_fl::shared_ptr<impeller::FilterInput>, std::_fl::allocator<std::_fl::shared_ptr<impeller::FilterInput>>> const&, impeller::ContentContext const&, impeller::Entity const&, impeller::Matrix const&, impeller::TRect<float> const&, std::_fl::optional<impeller::TRect<float>> const&) const + 260 (optional:260)
10 Flutter                        0x4f7c78 impeller::FilterContents::GetEntity(impeller::ContentContext const&, impeller::Entity const&, std::_fl::optional<impeller::TRect<float>> const&) const + 238 (filter_contents.cc:238)
11 Flutter                        0x4f7744 impeller::FilterContents::Render(impeller::ContentContext const&, impeller::Entity const&, impeller::RenderPass&) const + 344 (optional:344)
12 Flutter                        0x5190b0 impeller::EntityPass::RenderElement(impeller::Entity&, unsigned long, impeller::InlinePassContext&, int, impeller::ContentContext&, impeller::EntityPassClipStack&, impeller::TPoint<float>) const + 866 (entity_pass.cc:866)
13 Flutter                        0x517ec0 impeller::EntityPass::OnRender(impeller::ContentContext&, impeller::Capture&, impeller::TSize<long long>, impeller::EntityPassTarget&, impeller::TPoint<float>, impeller::TPoint<float>, unsigned int, impeller::EntityPassClipStack&, unsigned long, std::_fl::shared_ptr<impeller::Contents>, std::_fl::optional<impeller::InlinePassContext::RenderPassResult> const&) const + 1022 (entity_pass.cc:1022)
14 Flutter                        0x4b95b0 impeller::AiksContext::Render(impeller::Picture const&, impeller::RenderTarget&, bool) + 532 (entity_pass.cc:532)
15 Flutter                        0x372390 impeller::Renderer::Render(std::_fl::unique_ptr<impeller::Surface, std::_fl::default_delete<impeller::Surface>>, std::_fl::function<bool (impeller::RenderTarget&)> const&) const + 46 (renderer.cc:46)
16 Flutter                        0x5d17f8 std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLayer(SkISize const&)::$_0>, std::_fl::allocator<fml::internal::CopyableLambda<flutter::GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLayer(SkISize const&)::$_0>>, bool (flutter::SurfaceFrame&, flutter::DlCanvas*)>::operator()(flutter::SurfaceFrame&, flutter::DlCanvas*&&) + 169 (gpu_surface_metal_impeller.mm:169)
17 Flutter                        0x4b7fdc flutter::SurfaceFrame::Submit() + 51 (surface_frame.cc:51)
18 Flutter                        0x3f2698 flutter::Rasterizer::DrawToSurfacesUnsafe(flutter::FrameTimingsRecorder&, std::_fl::vector<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>, std::_fl::allocator<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>>>) + 763 (rasterizer.cc:763)
19 Flutter                        0x3f2b84 std::_fl::__function::__func<flutter::Rasterizer::DrawToSurfaces(flutter::FrameTimingsRecorder&, std::_fl::vector<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>, std::_fl::allocator<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>>>)::$_1, std::_fl::allocator<flutter::Rasterizer::DrawToSurfaces(flutter::FrameTimingsRecorder&, std::_fl::vector<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>, std::_fl::allocator<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>>>)::$_1>, void ()>::operator()() + 562 (rasterizer.cc:562)
20 Flutter                        0x2ecec0 fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 29 (shared_mutex.h:29)
21 Flutter                        0x3f1dd0 flutter::Rasterizer::DrawToSurfaces(flutter::FrameTimingsRecorder&, std::_fl::vector<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>, std::_fl::allocator<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>>>) + 470 (function.h:470)
22 Flutter                        0x3f3a04 std::_fl::__function::__func<flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&)::$_0, std::_fl::allocator<flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&)::$_0>, void (std::_fl::unique_ptr<flutter::FrameItem, std::_fl::default_delete<flutter::FrameItem>>)>::operator()(std::_fl::unique_ptr<flutter::FrameItem, std::_fl::default_delete<flutter::FrameItem>>&&) + 423 (vector:423)
23 Flutter                        0x3f3220 flutter::Rasterizer::Draw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>> const&) + 259 (unique_ptr.h:259)
24 Flutter                        0x40c924 std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::Shell::OnAnimatorDraw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>>)::$_0>, std::_fl::allocator<fml::internal::CopyableLambda<flutter::Shell::OnAnimatorDraw(std::_fl::shared_ptr<flutter::Pipeline<flutter::FrameItem>>)::$_0>>, void ()>::operator()() + 1277 (shell.cc:1277)
25 Flutter                        0x2eb47c fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 128 (message_loop_impl.cc:128)
26 Flutter                        0x2ee9f4 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 86 (message_loop_darwin.mm:86)
27 CoreFoundation                 0xcb624 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
28 CoreFoundation                 0x88f4c __CFRunLoopDoTimer + 940
29 CoreFoundation                 0x2e71c __CFRunLoopDoTimers + 288
30 CoreFoundation                 0x7a4d4 __CFRunLoopRun + 1852
31 CoreFoundation                 0x7f3ec CFRunLoopRunSpecific + 612
32 Flutter                        0x2eeae0 fml::MessageLoopDarwin::Run() + 52 (message_loop_darwin.mm:52)
33 Flutter                        0x2ee728 std::_fl::__function::__func<fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0, std::_fl::allocator<fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0>, void ()>::operator()() + 94 (message_loop_impl.cc:94)
34 Flutter                        0x2ee438 fml::ThreadHandle::ThreadHandle(std::_fl::function<void ()>&&)::$_0::__invoke(void*) + 470 (function.h:470)
35 libsystem_pthread.dylib        0x16b8 _pthread_start + 148
36 libsystem_pthread.dylib        0xb88 thread_start + 8
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.4.1 23E224 darwin-arm64, locale en-AE)
    • Flutter version 3.22.2 on channel stable at /Users/brunoreginato/fvm/versions/3.22.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (4 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3
```

</details>