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

don't set autoresizing mask on ios as that's not supported #6535

Merged
merged 4 commits into from
Nov 15, 2024

Conversation

mockersf
Copy link
Contributor

Connections
bevyengine/bevy#16363

Description
After updating to wgpu 23, Bevy crashes on iOS with fatal runtime error: Rust cannot catch foreign exceptions

This started with #6107

By adding logging between all lines of code in the get_metal_layer, it came from

let () = msg_send![new_layer, setAutoresizingMask: mask];

new_layer is a CAMetalLayer which is available on iOS https://developer.apple.com/documentation/quartzcore/cametallayer
but autoresizingMask is only available on macOS https://developer.apple.com/documentation/quartzcore/calayer/1410877-autoresizingmask

this PR stops setting the autoresizingMask on iOS

Testing

I tested the same fix on the 23 tag with Bevy and it works

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Nov 13, 2024
@Wumpf
Copy link
Member

Wumpf commented Nov 13, 2024

great find, thank you!
@madsmtm do you think we need to do something else on iOS instead?

Copy link
Contributor

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah damn, I think I relied on testing on Mac Catalyst a little bit too much, and then only tested previous iterations (but not the final PR) in the simulator - sorry!

@madsmtm do you think we need to do something else on iOS instead?

The details are a bit out of my cache here, but yes, we should be doing something different on iOS - but that's what #6210 is for.

In total, with #6107 and this PR, we're not worse off regarding resizing on iOS (it didn't work before). So 👍 from me.

wgpu-hal/src/metal/surface.rs Outdated Show resolved Hide resolved
Co-authored-by: Mads Marquart <[email protected]>
@Wumpf Wumpf enabled auto-merge (squash) November 15, 2024 08:06
@Wumpf Wumpf merged commit 4681f4f into gfx-rs:trunk Nov 15, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: needs back-porting PR with a fix that needs to land on crates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants