bevy/crates
François ccae4701da
configure_surface needs to be on the main thread on iOS (#12055)
# Objective

- Bevy fails to change screen orientation on iOS
```
Main Thread Checker: UI API called on a background thread: -[UIView layer]
PID: 37669, TID: 13872050, Thread name: Compute Task Pool (1), Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4   bevy_mobile_example                 0x0000000102cf92b8 _ZN60_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$6invoke17h8944e3d8ee34f15fE + 64
5   bevy_mobile_example                 0x0000000102c46358 _ZN4objc7message8platform15send_unverified17h667844cebe2d7931E + 132
6   bevy_mobile_example                 0x0000000102bcbd6c _ZN8wgpu_hal5metal7surface100_$LT$impl$u20$wgpu_hal..Surface$LT$wgpu_hal..metal..Api$GT$$u20$for$u20$wgpu_hal..metal..Surface$GT$9configure17h8a6af0f24cec1328E + 1548
7   bevy_mobile_example                 0x000000010279be50 _ZN9wgpu_core6device6global52_$LT$impl$u20$wgpu_core..global..Global$LT$G$GT$$GT$17surface_configure17h52709bbb3b3f0ff1E + 2792
8   bevy_mobile_example                 0x000000010287aacc _ZN84_$LT$wgpu..backend..wgpu_core..ContextWgpuCore$u20$as$u20$wgpu..context..Context$GT$17surface_configure17h54077b9f040286a4E + 508
9   bevy_mobile_example                 0x00000001028904b4 _ZN47_$LT$T$u20$as$u20$wgpu..context..DynContext$GT$17surface_configure17hfd6a0ac5a67a8f02E + 256
10  bevy_mobile_example                 0x00000001028a1870 _ZN4wgpu7Surface9configure17h97bf7dbd54220473E + 148
11  bevy_mobile_example                 0x0000000101fdc7cc _ZN11bevy_render8renderer13render_device12RenderDevice17configure_surface17h6853eab840b53e07E + 56
12  bevy_mobile_example                 0x000000010228eb64 _ZN11bevy_render4view6window15prepare_windows17hf6f8b3c93ba189b8E + 3248
13  bevy_mobile_example                 0x0000000102169eb8 _ZN4core3ops8function5FnMut8call_mut17h53ae762930afec98E + 192
14  bevy_mobile_example                 0x0000000101e46a80 _ZN4core3ops8function5impls79_$LT$impl$u20$core..ops..function..FnMut$LT$A$GT$$u20$for$u20$$RF$mut$u20$F$GT$8call_mut17h5789c37c5983ce4cE + 208
15  bevy_mobile_example                 0x0000000101e936e4 _ZN152_$LT$Func$u20$as$u20$bevy_ecs..system..function_system..SystemParamFunction$LT$fn$LP$F0$C$F1$C$F2$C$F3$C$F4$C$F5$C$F6$C$F7$RP$$u20$.$GT$$u20$Out$GT$$GT$3run10call_inner17h4ea44d3456146151E + 220
16  bevy_mobile_example                 0x0000000101e4683c _ZN152_$LT$Func$u20$as$u20$bevy_ecs..system..function_system..SystemParamFunction$LT$fn$LP$F0$C$F1$C$F2$C$F3$C$F4$C$F5$C$F6$C$F7$RP$$u20$.$GT$$u20$Out$GT$$GT$3run17h6515ba9e61bb4d59E + 204
17  bevy_mobile_example                 0x0000000101e7f99c _ZN120_$LT$bevy_ecs..system..function_system..FunctionSystem$LT$Marker$C$F$GT$$u20$as$u20$bevy_ecs..system..system..System$GT$10run_unsafe17h78999ea2add1da26E + 212
18  bevy_mobile_example                 0x0000000103b4ef60 _ZN8bevy_ecs8schedule8executor14multi_threaded21MultiThreadedExecutor17spawn_system_task28_$u7b$$u7b$closure$u7d$$u7d$28_$u7b$$u7b$closure$u7d$$u7d$17hb2572f7968d8618eE + 48
19  bevy_mobile_example                 0x0000000103b5bc9c _ZN4core3ops8function6FnOnce9call_once17h4cfa9d5c488566d4E + 16
20  bevy_mobile_example                 0x0000000103b2d58c _ZN115_$LT$core..panic..unwind_safe..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$9call_once17he61d5557ff370a2cE + 40
21  bevy_mobile_example                 0x0000000103b34548 _ZN3std9panicking3try7do_call17hb9ad087e1a06eb39E + 72
22  bevy_mobile_example                 0x0000000103b351bc __rust_try + 32
23  bevy_mobile_example                 0x0000000103b33a30 _ZN3std9panicking3try17hdebf82084f4342b0E + 76
24  bevy_mobile_example                 0x0000000103c4aedc _ZN3std5panic12catch_unwind17h7e60b22a0a18032eE + 12
25  bevy_mobile_example                 0x0000000103b4ea78 _ZN8bevy_ecs8schedule8executor14multi_threaded21MultiThreadedExecutor17spawn_system_task28_$u7b$$u7b$closure$u7d$$u7d$17h1af950387501b795E + 148
26  bevy_mobile_example                 0x0000000103b2cfa0 _ZN100_$LT$core..panic..unwind_safe..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h1258e4bf3dbe2fd8E + 48
```

## Solution

- run surface configuration on the main thread on iOS

## Migration Guide

System `need_new_surfaces` has been renamed `need_surface_configuration`
and now also configure the surfaces on window creation or resizing
2024-02-29 22:12:39 +00:00
..
bevy_a11y Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_animation Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_app Use immutable key for HashMap and HashSet (#12086) 2024-02-26 16:27:40 +00:00
bevy_asset Add methods to directly load assets from World (#12023) 2024-02-27 00:28:26 +00:00
bevy_audio Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_color Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_core Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
bevy_core_pipeline Register fxaa::Sensitivity and derive Debug (#12167) 2024-02-28 03:22:08 +00:00
bevy_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_diagnostic Make sysinfo diagnostic plugin optional (#12164) 2024-02-28 20:00:42 +00:00
bevy_dylib Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dynamic_plugin Document all members of bevy_dynamic_plugin (#12029) 2024-02-22 13:28:52 +00:00
bevy_ecs include links in error messages (#12165) 2024-02-28 00:01:18 +00:00
bevy_ecs_compile_fail_tests Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
bevy_encase_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_gilrs Make Gilrs a normal resource on non-Wasm targets (#12092) 2024-02-26 00:23:42 +00:00
bevy_gizmos Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_gltf Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_hierarchy Add a colon to error message link (#12174) 2024-02-28 03:23:27 +00:00
bevy_input Fix missing renaming of Input -> ButtonInput (#12096) 2024-02-24 18:41:17 +00:00
bevy_internal Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_log Update tracing-log requirement from 0.1.2 to 0.2.0 (#10404) 2024-02-27 03:25:42 +00:00
bevy_macro_utils fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Rename Direction2d/3d to Dir2/3 (#12189) 2024-02-28 22:48:43 +00:00
bevy_mikktspace fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_pbr Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_ptr Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_reflect Rename Direction2d/3d to Dir2/3 (#12189) 2024-02-28 22:48:43 +00:00
bevy_reflect_compile_fail_tests bevy_reflect_derive: Clean up attribute logic (#11777) 2024-02-12 15:16:27 +00:00
bevy_render configure_surface needs to be on the main thread on iOS (#12055) 2024-02-29 22:12:39 +00:00
bevy_scene Replace FromWorld requirement on ReflectResource and reflect Resource for State<S> (#12136) 2024-02-27 15:49:39 +00:00
bevy_sprite Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_tasks Add an index argument to parallel iteration helpers in bevy_tasks (#12169) 2024-02-29 08:50:44 +00:00
bevy_text Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
bevy_time Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_transform Rename Direction2d/3d to Dir2/3 (#12189) 2024-02-28 22:48:43 +00:00
bevy_ui Avoid panicking with non-UI nodes (#12213) 2024-02-29 21:36:45 +00:00
bevy_utils fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_window Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_winit Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00