Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS example crashes in 0.15-rc.3 and in main #16363

Closed
ferama opened this issue Nov 12, 2024 · 18 comments · Fixed by #16513
Closed

iOS example crashes in 0.15-rc.3 and in main #16363

ferama opened this issue Nov 12, 2024 · 18 comments · Fixed by #16513
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-iOS Specific to the iOS mobile operating system P-High This is particularly urgent, and deserves immediate attention P-Regression Functionality that used to work but no longer does. Add a test for this! S-Blocked This cannot move forward until something else changes
Milestone

Comments

@ferama
Copy link

ferama commented Nov 12, 2024

Bevy version

I attempted to run the iOS example using 0.15-rc.3 and from the latest commit in main (4225848)

Relevant system information

I'm using Rust v1.82.0 on MacOS Sonoma

What you did

Attempting to run the iOS example crashes with:

fatal runtime error: Rust cannot catch foreign exceptions
Can't show file for stack frame : <DBGLLDBStackFrame: 0x3396a8160> - stackNumber:3 - name:std::sys::pal::unix::abort_internal::hffa17df7d2f273a1. The file path does not exist on the file system: /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/pal/unix/mod.rs

It works in bevy 0.14.2

I also attemped to reduce the example removing almost everything.
This one crashes too:

//! A 3d Scene with a button and playing sound.

use bevy::prelude::*;

// the `bevy_main` proc_macro generates the required boilerplate for iOS and Android
#[bevy_main]
fn main() {
    let mut app = App::new();
    app.add_plugins(DefaultPlugins).run();
}
@ferama ferama added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 12, 2024
@alice-i-cecile
Copy link
Member

Can you please check 0.15.rc-2? There's a wgpu upgrade between them that is a very plausible candidate.

@ferama
Copy link
Author

ferama commented Nov 12, 2024

It works in 0.15.rc-2!
It seems you probably caught it

@ferama
Copy link
Author

ferama commented Nov 12, 2024

Confirming that reverting the wgpu upgrade commit (4b05d2f) makes the iOS example run again

@mockersf mockersf added this to the 0.15 milestone Nov 12, 2024
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen O-iOS Specific to the iOS mobile operating system and removed S-Needs-Triage This issue needs to be labelled labels Nov 12, 2024
@alice-i-cecile
Copy link
Member

Thanks a ton for checking that. I've brought it to the awareness of the relevant experts.

@alice-i-cecile alice-i-cecile added P-High This is particularly urgent, and deserves immediate attention S-Needs-Investigation This issue requires detective work to figure out what's going wrong P-Regression Functionality that used to work but no longer does. Add a test for this! labels Nov 12, 2024
@Wumpf
Copy link

Wumpf commented Nov 12, 2024

There's not a whole lot of changes in that wgpu version on Metal/Mac/Apple specific things. But the linked upgrade commit also does changes to xcode projects, could those be relevant? 4b05d2f#diff-10e1daed39805d49f29b77cec041a235e4c8a8795169b84bdb28df24af5d6c0c
Otherwise I'd suspect it's third party crate updates that may have caused this.

@tychedelia
Copy link
Contributor

But the linked upgrade commit also does changes to xcode projects, could those be relevant? 4b05d2f#diff-10e1daed39805d49f29b77cec041a235e4c8a8795169b84bdb28df24af5d6c0c

That was due to changes in gfx-rs/wgpu#6107.

@mockersf
Copy link
Member

fixed by gfx-rs/wgpu#6535 on wgpu side

@mnmaita mnmaita added S-Blocked This cannot move forward until something else changes and removed S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Nov 13, 2024
@mnmaita
Copy link
Member

mnmaita commented Nov 25, 2024

wgpu 23.0.1 was just released, @ferama would you be able to test this again and confirm that the issue is no longer there? Thanks!

@ferama
Copy link
Author

ferama commented Nov 25, 2024

Cloning...

git clone git@github.com:bevyengine/bevy.git
git checkout release-0.15.0

Patching wgpu version...

diff --git a/crates/bevy_image/Cargo.toml b/crates/bevy_image/Cargo.toml
index 7b317a521..4346ee0d8 100644
--- a/crates/bevy_image/Cargo.toml
+++ b/crates/bevy_image/Cargo.toml
@@ -49,7 +49,7 @@ image = { version = "0.25.2", default-features = false }
 # misc
 bitflags = { version = "2.3", features = ["serde"] }
 bytemuck = { version = "1.5" }
-wgpu = { version = "23", default-features = false }
+wgpu = { version = "23.0.1", default-features = false }
 serde = { version = "1", features = ["derive"] }
 derive_more = { version = "1", default-features = false, features = [
   "error",
diff --git a/crates/bevy_mesh/Cargo.toml b/crates/bevy_mesh/Cargo.toml
index 85e7c1503..8a2fda119 100644
--- a/crates/bevy_mesh/Cargo.toml
+++ b/crates/bevy_mesh/Cargo.toml
@@ -24,7 +24,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-rc.3" }
 # misc
 bitflags = { version = "2.3", features = ["serde"] }
 bytemuck = { version = "1.5" }
-wgpu = { version = "23", default-features = false }
+wgpu = { version = "23.0.1", default-features = false }
 serde = { version = "1", features = ["derive"] }
 hexasphere = "15.0"
 derive_more = { version = "1", default-features = false, features = [
diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml
index 9535fb61e..559a56946 100644
--- a/crates/bevy_render/Cargo.toml
+++ b/crates/bevy_render/Cargo.toml
@@ -68,7 +68,7 @@ codespan-reporting = "0.11.0"
 # It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm.
 # When the 'atomics' feature is enabled `fragile-send-sync-non-atomic` does nothing
 # and Bevy instead wraps `wgpu` types to verify they are not used off their origin thread.
-wgpu = { version = "23", default-features = false, features = [
+wgpu = { version = "23.0.1", default-features = false, features = [
   "wgsl",
   "dx12",
   "metal",

Launching...

cd examples/mobile && make run

It works now :) Thanks guys

@alice-i-cecile
Copy link
Member

You rock: thanks for testing this!

@ferama
Copy link
Author

ferama commented Nov 25, 2024

Mmm why the issue is closed? There is not any commit with the new version of wgpu on bevy repo, I only applied the patch manually and tested it locally. Do I misunderstood something?

@tim-blackbird
Copy link
Contributor

The versions specified in Cargo.toml match any SemVer compatible updates, so there is no need to update them. Running cargo update is enough.
See Cargo's docs for more info

@mockersf
Copy link
Member

I still think we should correctly specify the patch to not allow an invalid combination

github-merge-queue bot pushed a commit that referenced this issue Nov 25, 2024
# Objective

- Fixes #16363
- Ensure that someone using minimum version doesn't get the bugs that
were fixed in the 23.0.1 patch

## Solution

- Use wgpu 23.0.1
mockersf added a commit that referenced this issue Nov 25, 2024
# Objective

- Fixes #16363
- Ensure that someone using minimum version doesn't get the bugs that
were fixed in the 23.0.1 patch

## Solution

- Use wgpu 23.0.1
@ferama
Copy link
Author

ferama commented Nov 26, 2024

Guys unfortunately it seems there is another issue. The app launches and run with wgpu 23.0.1 but the interaction with the button doesn’t work.

I noticed that the same happens if I run a wasm build .

To be more specific running the wasm build, ui button interactions works until you open the browser developer console and enable phone screen simulator (tested with chrome) You can test it using the button example from bevy example ui folder

It works in 0.14.2, maybe I should test with 0.15rc2 this too but it seems more ui related.

github-merge-queue bot pushed a commit that referenced this issue Nov 26, 2024
# Objective

- Fix the issue mentioned on iOS in
#16363 (comment)
- touch on the button in the mobile example are not detected

## Solution

- UI focus now uses the window scale factor for touches
mockersf added a commit that referenced this issue Nov 26, 2024
# Objective

- Fix the issue mentioned on iOS in
#16363 (comment)
- touch on the button in the mobile example are not detected

## Solution

- UI focus now uses the window scale factor for touches
mockersf added a commit that referenced this issue Nov 26, 2024
# Objective

- Fix the issue mentioned on iOS in
#16363 (comment)
- touch on the button in the mobile example are not detected

## Solution

- UI focus now uses the window scale factor for touches
@mockersf
Copy link
Member

@ferama touch interaction should now work on iOS if you try the release-0.15.0 branch.

I couldn't reproduce in wasm. my fix was about touch, maybe this "phone screen emulator" replaces click by touches input. Could you also try?

@ferama
Copy link
Author

ferama commented Nov 27, 2024

Now works properly on mobile, thanks again for the effort.

Still there is a regression on wasm build (works on 0.14.2, do not with release-0.15.0 branch)
Maybe this should become a separate issue.

How I tested:

$ cargo build --target wasm32-unknown-unknown --example button
$ wasm-server-runner target/wasm32-unknown-unknown/debug/examples/button.wasm

Point the chrome browser at http://127.0.0.1:1334. Interactions with the button works properly.
Now from chrome enable developer tools, click on the icon with a Laptop and a little phone to Toggle the device toolbar, choose a device. Now the button doesn't work anymore

Another proof that in 0.14.2 works is that if you point your phone mobile browser at https://bevyengine.org/examples/ui-user-interface/button/ it works as expected.

@mockersf
Copy link
Member

works for me on chromium. there's no hover but I guess that's normal as there isn't a touch equivalent, but press/release works correctly

chrome.device.simulator.mp4

@ferama
Copy link
Author

ferama commented Nov 28, 2024

I agree with you about the hover event.
Anyway I have more details: If I choose iPhone SE or iPhone XR from the list it works.
iPhone 12 pro, iPhone 14 pro max and so on it doesn't.
iPad mini it starts to work again. Maybe it is resolution related?

Repeating the steps above on 0.14.2, it always works

ecoskey pushed a commit to ecoskey/bevy that referenced this issue Dec 2, 2024
# Objective

- Fixes bevyengine#16363
- Ensure that someone using minimum version doesn't get the bugs that
were fixed in the 23.0.1 patch

## Solution

- Use wgpu 23.0.1
ecoskey pushed a commit to ecoskey/bevy that referenced this issue Dec 2, 2024
# Objective

- Fix the issue mentioned on iOS in
bevyengine#16363 (comment)
- touch on the button in the mobile example are not detected

## Solution

- UI focus now uses the window scale factor for touches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-iOS Specific to the iOS mobile operating system P-High This is particularly urgent, and deserves immediate attention P-Regression Functionality that used to work but no longer does. Add a test for this! S-Blocked This cannot move forward until something else changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants