Skip to content

[Merged by Bors] - Don't update when suspended to avoid GPU use on iOS. - #2482

Closed
HackerFoo wants to merge 2 commits into
bevyengine:mainfrom
HackerFoo:idle_on_suspend
Closed

HackerFoo wants to merge 2 commits into
bevyengine:mainfrom
HackerFoo:idle_on_suspend

Conversation

@HackerFoo

Copy link
Copy Markdown
Contributor

Objective

This fixes a crash caused by iOS preventing GPU access when not focused: #2296

Solution

This skips app.update() in winit_runner when winit sends the Suspended event, until Resumed.

I've tested that this works for me on my iOS app.

@github-actions github-actions Bot added the S-Needs-Triage This issue needs to be labelled label Jul 14, 2021
@mockersf

mockersf commented Jul 14, 2021 •

Copy link
Copy Markdown
Member

Ideally we would want to stop only the render part of the update when suspended, but that's much more complicated...

This is a good solution I think until we can do that 👍 (unless the rendering rework offers a better solution?)

Do you know if that fixes the similar issue on android?

@mockersf mockersf added A-App Bevy apps and plugins O-iOS Specific to the iOS mobile operating system and removed S-Needs-Triage This issue needs to be labelled labels Jul 14, 2021
@alice-i-cecile

Copy link
Copy Markdown
Member

bors try

bors Bot added a commit that referenced this pull request Jul 14, 2021
@bors

bors Bot commented Jul 14, 2021

Copy link
Copy Markdown

try

Build failed:

@HackerFoo

Copy link
Copy Markdown
Contributor Author

@mockersf I have not tested this on Android.

@alice-i-cecile alice-i-cecile added the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Jul 15, 2021
@mockersf

Copy link
Copy Markdown
Member

bors try

bors Bot added a commit that referenced this pull request Jul 15, 2021

@cart cart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like a solid solution until we can decouple rendering from updates. I'm sold!

@cart

cart commented Jul 16, 2021

Copy link
Copy Markdown
Member

bors r+

bors Bot pushed a commit that referenced this pull request Jul 16, 2021
# Objective

This fixes a crash caused by iOS preventing GPU access when not focused: #2296

## Solution

This skips `app.update()` in `winit_runner` when `winit` sends the `Suspended` event, until `Resumed`.

I've tested that this works for me on my iOS app.
@mockersf

Copy link
Copy Markdown
Member

@HackerFoo could you comment on #2373 if you're ok with the license change?

@HackerFoo

Copy link
Copy Markdown
Contributor Author

@mockersf Done.

@mockersf

Copy link
Copy Markdown
Member

thanks!

@bors bors Bot changed the title Don't update when suspended to avoid GPU use on iOS. [Merged by Bors] - Don't update when suspended to avoid GPU use on iOS. Jul 16, 2021
@bors bors Bot closed this Jul 16, 2021
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
# Objective

This fixes a crash caused by iOS preventing GPU access when not focused: bevyengine#2296

## Solution

This skips `app.update()` in `winit_runner` when `winit` sends the `Suspended` event, until `Resumed`.

I've tested that this works for me on my iOS app.
@TheRawMeatball TheRawMeatball mentioned this pull request Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-App Bevy apps and plugins O-iOS Specific to the iOS mobile operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants