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

Empty game (no logic) has 50% CPU usage and low FPS (40+ instead of 60) on iOS #16734

Open
wentao opened this issue Dec 9, 2024 · 4 comments
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior C-Performance A change motivated by improving speed, memory usage or compile times O-iOS Specific to the iOS mobile operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@wentao
Copy link

wentao commented Dec 9, 2024

Bevy version

Tested on both 0.14.2

[Optional] Relevant system information

Tested on

  • iPhone 16 Simulator
  • iPhone 13

If your bug is rendering-related, copy the adapter info that appears when you run Bevy.

AdapterInfo { name: "Apple A15 GPU", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

What you did

I setup a bare minimum project to demonstrate the issue https://github.com/80gen/bevy_ios_bug/tree/cpu_high

What went wrong

The game logic doesn't have anything, not even a camera setup, see https://github.com/80gen/bevy_ios_bug/blob/cpu_high/crates/game/src/lib.rs

When running the game on desktop (in my test it's Macbook Pro M1), it looks fine, with CPU usage at 10%. No error log.

But when the game run in either iOS Simulator or physical phone, the CPU usage stay above 50% and FPS average at 40 (should be 60).

Here is a screenshot from the XCode debugger
Image

The XCode terminal is showing the following log

AdapterInfo { name: "Apple iOS simulator GPU", vendor: 0, device: 0, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Metal }
AddInstanceForFactory: No factory registered for id <CFUUID 0x600000245a60> F8BB1C28-BAE8-11D6-9C31-00039315CD46
Failed to start Gilrs. Gilrs does not support current platform.
processing non `RedrawRequested` event after the main event loop: AboutToWait
Creating new window "App" (0v1#4294967296)
`WindowAttributes::min_inner_size` is ignored on iOS
`Window::theme` is ignored on iOS
processing non-`RedrawRequested` event after the main event loop: WindowEvent {
    window_id: WindowId {
        window: 0x0000000105a9fd30,
    },
    event: Focused(
        true,
    ),
}
processing non-`RedrawRequested` event after the main event loop: WindowEvent {
    window_id: WindowId {
        window: 0x0000000105a9fd30,
    },
    event: Resized(
        PhysicalSize {
            width: 3840,
            height: 2160,
        },
    ),
}
processing `RedrawRequested` during the main event loop
processing non `RedrawRequested` event after the main event loop: AboutToWait
"finished frame"  tracy.frame_mark=true
processing `RedrawRequested` during the main event loop
processing non `RedrawRequested` event after the main event loop: AboutToWait
"finished frame"  tracy.frame_mark=true
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
processing non `RedrawRequested` event after the main event loop: AboutToWait
"finished frame"  tracy.frame_mark=true

And this line get repeated infinitely

�[2m2024-12-09T23:09:26.510999Z�[0m �[33m WARN�[0m �[2mwinit::platform_impl::ios::app_state�[0m�[2m:�[0m processing non `RedrawRequested` event after the main event loop: AboutToWait
�[2m2024-12-09T23:09:26.513511Z�[0m �[33m WARN�[0m �[2mwinit::platform_impl::ios::app_state�[0m�[2m:�[0m processing non `RedrawRequested` event after the main event loop: AboutToWait
@wentao wentao added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Dec 9, 2024
@alice-i-cecile alice-i-cecile added A-Windowing Platform-agnostic interface layer to run your app in C-Performance A change motivated by improving speed, memory usage or compile times and removed S-Needs-Triage This issue needs to be labelled labels Dec 9, 2024
@alice-i-cecile
Copy link
Member

This is probably the same / similar root cause as #10261, and due to a faulty windowing event loop somehow.

@alice-i-cecile alice-i-cecile added O-iOS Specific to the iOS mobile operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Dec 9, 2024
@wentao
Copy link
Author

wentao commented Dec 9, 2024

Did more testing, and noticed somehow I can't get anything to render on 0.15, so I updated this bug to be reproduce-able on 0.14.2 for now.

@wentao
Copy link
Author

wentao commented Dec 9, 2024

This is probably the same / similar root cause as #10261, and due to a faulty windowing event loop somehow.

I don't think so. I've tested this on my Macbook Pro M1 and the CPU usage is around 10%. The issue with CPU and FPS only happens on iOS.

@wentao
Copy link
Author

wentao commented Dec 10, 2024

Sorry I have to take my words back. Tested on Macbook Pro M1 and the CPU is around 40% (not 10%). This time I'm using examples from https://bevyengine.org/examples/3d-rendering/3d-scene/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior C-Performance A change motivated by improving speed, memory usage or compile times 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

No branches or pull requests

2 participants