Android: panic on some devices when MSAA is enabled
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version
4f16d6e0dc14c12ab29b72880d5d3d22003eed72
## \[Optional\] Relevant system information
Not all devices are concerned, from some tests:
- Google Pixel 7
-
```ignore
AdapterInfo { name: "Mali-G710", vendor: 5045, device: 2824994820, device_type: IntegratedGpu, driver: "Mali-G710", driver_info: "v1.r36p0-01eac0.1f36dec337e44918d811de9a8a2acf4d", backend: Vulkan }
SystemInfo { os: "Android 13 Pixel 7", kernel: "5.10.107-android13-4-00003-g777901393eee-ab8910922", cpu: "", core_count: "8", memory: "7.3 GiB" }
```
## What you did
Running example `bevy_mobile`
## What went wrong
It crashes with a panic.
```
E/log event(18160): Handling wgpu errors as fatal by defaultlog.target = "wgpu::backend::direct"; log.module_path = "wgpu::backend::direct"; log.file = "/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.15.1/src/backend/direct.rs"; log.line = 3023;
I/RustStdoutStderr(18160): thread 'Compute Task Pool (3)' panicked at 'wgpu error: Validation Error
I/RustStdoutStderr(18160):
I/RustStdoutStderr(18160): Caused by:
I/RustStdoutStderr(18160): In Device::create_render_pipeline
I/RustStdoutStderr(18160): note: label = `pbr_opaque_mesh_pipeline`
I/RustStdoutStderr(18160): parent device is lost
I/RustStdoutStderr(18160):
I/RustStdoutStderr(18160): ', /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.15.1/src/backend/direct.rs:3024:5
I/RustStdoutStderr(18160): note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I/RustStdoutStderr(18160): thread 'Compute Task Pool (3)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:194:60
I/RustStdoutStderr(18160): thread '' panicked at 'called `Option::unwrap()` on a `None` value', /home/runner/work/bevy/bevy/crates/bevy_tasks/src/task_pool.rs:376:49
I/RustStdoutStderr(18160): thread 'Compute Task Pool (3)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:135:45
I/RustStdoutStderr(18160): thread '' panicked at 'called `Option::unwrap()` on a `None` value', /home/runner/work/bevy/bevy/crates/bevy_tasks/src/task_pool.rs:376:49
```
## Additional information
Disabling `MSAA` makes it not crash
```
D/CompatibilityChangeReporter(18160): Compat change id reported: 171979766; UID 10346; state: ENABLED
W/System (18160): ClassLoader referenced unknown path:
V/GraphicsEnvironment(18160): ANGLE Developer option for 'org.bevyengine.example' set to: 'default'
V/GraphicsEnvironment(18160): ANGLE GameManagerService for org.bevyengine.example: false
V/GraphicsEnvironment(18160): Neither updatable production driver nor prerelease driver is supported.
D/NetworkSecurityConfig(18160): No Network Security Config specified, using platform default
D/NetworkSecurityConfig(18160): No Network Security Config specified, using platform default
D/vulkan (18160): searching for layers in '/data/app/~~ZCJbY6uAuTISggZQj__QIg==/org.bevyengine.example-u3PWKJXCOlZYMfs4tXFUXQ==/lib/arm64'
D/vulkan (18160): searching for layers in '/data/app/~~ZCJbY6uAuTISggZQj__QIg==/org.bevyengine.example-u3PWKJXCOlZYMfs4tXFUXQ==/base.apk!/lib/arm64-v8a'
D/libEGL (18160): loaded /vendor/lib64/egl/libGLES_mali.so
I/event crates/bevy_render/src/renderer/mod.rs:128(18160): AdapterInfo { name: "Mali-G710", vendor: 5045, device: 2824994820, device_type: IntegratedGpu, driver: "Mali-G710", driver_info: "v1.r36p0-01eac0.1f36dec337e44918d811de9a8a2acf4d", backend: Vulkan }
I/yengine.example(18160): Explicit concurrent copying GC freed 50724(2140KB) AllocSpace objects, 3(60KB) LOS objects, 92% free, 1987KB/25MB, paused 23us,6us total 2.953ms
I/yengine.example(18160): Explicit concurrent copying GC freed 4640(170KB) AllocSpace objects, 1(20KB) LOS objects, 92% free, 1977KB/25MB, paused 42us,39us total 12.454ms
I/OboeAudio(18160): openStream() OUTPUT -------- OboeVersion1.7.0 --------
D/OboeAudio(18160): AAudioLoader(): dlopen(libaaudio.so) returned 0xdb5797d5cdecc11
I/AAudio (18160): AAudioStreamBuilder_openStream() called ----------------------------------------
I/AudioStreamBuilder(18160): rate = 44100, channels = 2, channelMask = 0x80000003, format = 5, sharing = SH, dir = OUTPUT
I/AudioStreamBuilder(18160): device = 0, sessionId = -1, perfMode = 10, callback: ON with frames = 0
I/AudioStreamBuilder(18160): usage = 1, contentType = 2, inputPreset = 6, allowedCapturePolicy = 0
I/AudioStreamBuilder(18160): privacy sensitive = false, opPackageName = (null), attributionTag = (null)
D/AudioStreamBuilder(18160): build() MMAP not used because AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not requested.
D/yengine.example(18160): PlayerBase::PlayerBase()
D/AudioStreamTrack(18160): open(), request notificationFrames = 0, frameCount = 0
D/AAudioStream(18160): setState(s#1) from 0 to 2
I/AAudio (18160): AAudioStreamBuilder_openStream() returns 0 = AAUDIO_OK for s#1 ----------------
D/OboeAudio(18160): AudioStreamAAudio.open() format=2, sampleRate=44100, capacity = 3544
D/OboeAudio(18160): calculateDefaultDelayBeforeCloseMillis() default = 41
D/OboeAudio(18160): AudioStreamAAudio.open: AAudioStream_Open() returned AAUDIO_OK
D/AAudio (18160): AAudioStream_requestStart(s#1) called --------------
D/AAudioStream(18160): setState(s#1) from 2 to 3
D/AAudio (18160): AAudioStream_requestStart(s#1) returned 0 ---------
D/AudioStreamLegacy(18160): onAudioDeviceUpdate(deviceId = 3)
E/event crates/bevy_gilrs/src/lib.rs:26(18160): Failed to start Gilrs. Gilrs does not support current platform.
W/log event(18160): TODO: forward onStart notification to applicationlog.target = "winit::platform_impl::platform"; log.module_path = "winit::platform_impl::platform"; log.file = "/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.3/src/platform_impl/android/mod.rs"; log.line = 449;
D/CompatibilityChangeReporter(18160): Compat change id reported: 210923482; UID 10346; state: DISABLED
D/CompatibilityChangeReporter(18160): Compat change id reported: 37756858; UID 10346; state: ENABLED
I/event crates/bevy_winit/src/system.rs:51(18160): Creating new window "Bevy App" (0v0)
I/event crates/bevy_diagnostic/src/system_information_diagnostics_plugin.rs:130(18160): SystemInfo { os: "Android 13 Pixel 7", kernel: "5.10.107-android13-4-00003-g777901393eee-ab8910922", cpu: "", core_count: "8", memory: "7.3 GiB" }
D/AAudioStream(18160): setState(s#1) from 3 to 4
E/log event(18160): Handling wgpu errors as fatal by defaultlog.target = "wgpu::backend::direct"; log.module_path = "wgpu::backend::direct"; log.file = "/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.15.1/src/backend/direct.rs"; log.line = 3023;
I/RustStdoutStderr(18160): thread 'Compute Task Pool (3)' panicked at 'wgpu error: Validation Error
I/RustStdoutStderr(18160):
I/RustStdoutStderr(18160): Caused by:
I/RustStdoutStderr(18160): In Device::create_render_pipeline
I/RustStdoutStderr(18160): note: label = `pbr_opaque_mesh_pipeline`
I/RustStdoutStderr(18160): parent device is lost
I/RustStdoutStderr(18160):
I/RustStdoutStderr(18160): ', /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.15.1/src/backend/direct.rs:3024:5
I/RustStdoutStderr(18160): note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I/RustStdoutStderr(18160): thread 'Compute Task Pool (3)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', crates/bevy_ecs/src/schedule/executor/multi_threaded.rs:194:60
I/RustStdoutStderr(18160): thread '' panicked at 'called `Option::unwrap()` on a `None` value', /home/runner/work/bevy/bevy/crates/bevy_tasks/src/task_pool.rs:376:49
I/RustStdoutStderr(18160): thread 'Compute Task Pool (3)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:135:45
I/RustStdoutStderr(18160): thread '' panicked at 'called `Option::unwrap()` on a `None` value', /home/runner/work/bevy/bevy/crates/bevy_tasks/src/task_pool.rs:376:49
```
https://user-images.githubusercontent.com/8672791/227961502-f25dca90-2dbd-42fc-a211-64ba77a7d403.mp4
Contributor guide
Research direction
Start by running the examples/bevy_mobile example with MSAA enabled on the reported Pixel 7/Mali-G710 Vulkan setup. Read the render pipeline path around the pbr_opaque_mesh_pipeline error and crates/bevy_render/src/renderer/mod.rs, then reproduce the device-lost panic. Done means the example no longer panics on the affected device when MSAA is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, rust
- Domain
- computer-graphics, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100