bevy icon indicating copy to clipboard operation
bevy copied to clipboard

`Main`/`Render` schedules be run at different real timing.

Open B-head opened this issue 2 years ago • 3 comments

This pull request is stacked on #8961.

Objective

Allow the tick rate and frame rate to be configured to different values.

This PR supports the prerequisite that the Main schedule and the Render schedule be run at different real timings.

Note that tick rate and frame rate control will be implemented in a later PR.

Solution

Call SubApp::extract and SubApp::run in the exclusive system. Add that system to the Render schedule.

Moved the responsibility for running top-level schedules from App struct to the runner function. Within the runner function, call World::run_schedule to run schedules separately.


Changelog

Added

  • Added app::SubApp::main_schedule_label.
  • Added app::ScheduleRunnerPlugin::main_schedule_label.
  • Added winit::WinitSettings::main_schedule_label.
  • Added winit::WinitSettings::render_schedule_label.
  • Added app::App::update_sub_apps.

Changed

  • Moved render::Render to app::Render.
  • Moved render::Render::base_schedule to render::RenderSet::base_schedule. (Back in place?)
  • Added Sync bounds to app::App::runner.
  • Added Sync bounds to app::SubApp::extract.
  • If only RenderPlugin is used, the RenderApp instance will not be accessible after cleanup.

Removed

  • Removed render::pipelined_rendering::RenderExtractApp.
  • Removed app::App::update.
  • Removed app::App::main_schedule_label.

Migration Guide

The top-level schedules configuration has been moved from App to plugins for setting the runner function. See ScheduleRunnerPlugin or WinitSettings.

Replace the code that calls App::update in the runner function with the following:

app.world.run_schedule(Main);
app.world.run_schedule(Render);
app.update_sub_apps();
app.world.clear_trackers();

(The real timing for running top-level schedules has not yet been changed.)

B-head avatar Jun 27 '23 21:06 B-head

Example no_renderer failed to run, please try running it locally and check the result.

github-actions[bot] avatar Jun 27 '23 21:06 github-actions[bot]

I made a mistake and did not stack correctly on #8961, so I restored it. The force push just before can be ignored.

B-head avatar Jun 28 '23 14:06 B-head

What's the goal of this PR? Is it to make it possible to call the the main schedule and the render schedule separately in the runner?

In terms of implementation, yes.

In terms of designs, I want to remove obstacles to good design. Current status:

  • To run a render, the runner function must know details of the render plugin.
  • Since the App struct is responsibility for running the top-level schedule, the runner function can only be controlled indirectly from the App.

B-head avatar Jun 28 '23 16:06 B-head