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§

debug
Adds diagnostic logging and a cursor for debugging.

Structs§

FramePaceStats
Holds frame time measurements for framepacing diagnostics
FrameTimer
Tracks the instant of the end of the previous frame.
FramepacePlugin
Adds framepacing and framelimiting functionality to your App.
FramepaceSettings
Framepacing plugin configuration.
FrametimeLimit
Current frametime limit based on settings and monitor refresh rate.

Enums§

Limiter
Configures the framelimiting technique for the app.