-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Refactor render_system into multiple systems #11233
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
could you give more detail on where the framepacing systems need to go and why? Moving the time into another system is going to make the time more inaccurate as it'll add some slop from the executor. |
Framepacing systems need to go immediately before and after frame presentation. This lets us:
|
|
After reading this comment from @nicopap and this comment from @daxpedda, I am thoroughly confused. Where is the vblank delay, how am I supposed to measure it accurately, and how can I insert custom delays immediately before the vblank for framerate smoothing? Are these answers different for non-pipelined vs pipelined rendering? Are these answers different depending on platform (on Mac M1, the vblank is in On another note, this PR is incomplete (or needs a follow-up). For apps with pipelined rendering we need to measure how long the main app blocks while waiting to extract into the render app (handoff slop). This can be done (theoretically) by running a subapp immediately before I want to implement a generic 'slop-reporting' mechanism that can report slop durations to the framepace engine, which collects and analyzes slop, and decides what delays to add before and after the vblank. |
Winit offers (currently?) no way to access VBlank timings. See rust-windowing/winit#2412 for more details. AFAIK some Winit backends are potentially capable of actually providing VBlank timings, at least Wayland and Windows I believe, but this is currently not implemented in Winit. |
After a great deal of thought I've concluded this PR does not accomplish anything based on the current frame-presentation API, and there is no way forward without gfx-rs/wgpu#2869. |
Objective
Framepacing requires access to frame presentation times. Framerate smoothing requires the ability to insert systems around frame presentation.
Solution
Refactor
render_system
into multiple systems so the newpresent_system
can be isolated.The old
render_system
was renamed torender_graph_system
to encourage intentional migration.Changelog
Changed
render_system
was replaced with a set of systems inbevy_render::renderer
:render_graph_system
,present_system
,finalize_render_system
,send_time_system
.Migration Guide
Systems that were scheduled
.after(bevy_render::renderer::render_system)
should now be scheduled.after(bevy_render::renderer::send_time_system)
to preserve the same behavior. Systems scheduled.before(bevy_render::renderer::render_system)
can be scheduled.before(bevy_render::renderer::render_graph_system)
.Alternatives
This API change is fragile, since any changes to system ordering may invalidate a framepace implementation that manually schedules its systems around
present_system
. One alternative would be higher-granularity system sets, or even an extra system set for justpresent_system
.Useful resources