Crate bevy_framepace

source ·
Expand description

This is a bevy plugin that adds framepacing and framelimiting to improve input latency and power use.

§How it works

This works by sleeping the app immediately before the event loop starts. In doing so, this minimizes the time from when user input is captured (start of event loop), to when the frame is presented on screen. Graphically, it looks like this:

          /-- latency --\             /-- latency --\
 sleep -> input -> render -> sleep -> input -> render
 \----- event loop -----/    \----- event loop -----/

One of the interesting benefits of this is that you can keep latency low even if the framerate is limited to a low value. Assuming you are able to reach the target frametime, there should be no difference in motion-to-photon latency when limited to 10fps or 120fps.

               same                                              same
          /-- latency --\                                   /-- latency --\
 sleep -> input -> render -> sleeeeeeeeeeeeeeeeeeeeeeeep -> input -> render
 \----- event loop -----/    \---------------- event loop ----------------/
          60 fps                           limited to 10 fps

Modules§

  • Adds diagnostic logging and a cursor for debugging.

Structs§

Enums§

  • Configures the framelimiting technique for the app.