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

Per-Window Event Loops #5645

Open
aevyrie opened this issue Aug 10, 2022 · 0 comments
Open

Per-Window Event Loops #5645

aevyrie opened this issue Aug 10, 2022 · 0 comments
Labels
A-ECS Entities, components, systems, and events A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Enhancement A new feature

Comments

@aevyrie
Copy link
Member

aevyrie commented Aug 10, 2022

What problem does this solve or what need does it fill?

  • Frame pacing assumes the event loop is being run on a single display. If multiple windows share the same event loop, there is no way to do any kind of framepacing or framelimiting across displays without introducing excess lag. Framepacing/limiting works by pausing the schedule to delay input gathering until just enough time is left before frame presentation to render the frame. If two windows are on different displays with different refresh rates (consider XR), there is no way for both of these windows to share an event loop without causing some kind of visual/temporal artifacts (stuttering vs. lag).
  • AFAIK, winit only reports touch events for the primary window, making it impossible to support touch on multiple windows within the same winit context.

What solution would you like?

  1. Every window would have its own event loop. I have no idea if it would even be possible to sync worlds if the schedules, by definition, cannot be in lockstep.
  2. Alternatively, gather inputs constantly in channels, and pass them into the app, with each window's schedule choosing when to read from the input channel. This is a pseudo event loop that relies on inputs being pulled instead of being pushed.

What alternative(s) have you considered?

  1. Accepting this as a limitation of bevy, and rely on IPC to handle multi-window applications. Document this limitation.
  2. With "true" render pipelining, decouple render sync points and frequency from the main app schedule. This doesn't solve the input latency vs. stuttering tradeoff, but it would allow independent rendering framerates per window.
@aevyrie aevyrie added C-Enhancement A new feature A-Rendering Drawing game state to the screen A-ECS Entities, components, systems, and events A-Windowing Platform-agnostic interface layer to run your app in labels Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Enhancement A new feature
Projects
None yet
Development

No branches or pull requests

1 participant