Skip to content

Very long RedrawRequested emission on WASM application #4429

@Nathan-M-code

Description

@Nathan-M-code

Description

I'm using new version 0.31.0-beta.2
I did not try with another version.

I use wgpu in Fifo present mode.

Each frame I display:

  • RedrawRequested delta: the time between two RedrawRequested receptions.
  • game logic elapsed: the time to handle all my code between two RedrawRequested receptions.

RedrawRequested emission is quite regular, but very long on WASM, 60 FPS unreachable.
Maybe I'm wrong but I suppose the browser is throttling the application even though the tab is focused and I'm using it.
I couldn't investigate more.
Is that a winit bug ?

Native:

Event loop setup:

    let event_loop = EventLoop::new().unwrap();
    event_loop.set_control_flow(ControlFlow::Poll);
    event_loop.run_app(Game::empty()).unwrap();
DEBUG game: RedrawRequested delta: 16ms894µs968ns
DEBUG game: game logic elapsed: 4ms695µs704ns
...

Web - Firefox:

Event loop setup:

    let event_loop = EventLoop::new().unwrap();
    event_loop.set_control_flow(ControlFlow::Poll);
    event_loop.set_poll_strategy(PollStrategy::Scheduler); //already by default
    event_loop.run_app(Game::empty()).unwrap();
DEBUG game: RedrawRequested delta: 82ms
DEBUG game: game logic elapsed: 5ms
...

Tested browsers

Firefox

Tested devices

Laptop ubuntu 22

Winit version

0.31.0-beta.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - webAffects the Web backend (WebAssembly/WASM)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions