Skip to main content

euv_core/game/pacing/
enum.rs

1use super::*;
2
3/// External trigger presented to `FramePacingController` to determine whether simulation and rendering should proceed.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
5pub enum FramePacingTrigger {
6    /// Authoritative platform VSync, Choreographer, CADisplayLink, or `requestAnimationFrame` signal.
7    #[default]
8    Vsync,
9    /// Pointer, touch, keyboard, or gamepad input arrival.
10    InputEvent,
11    /// System safe-area inset change (notch, navigation bar, IME animation).
12    SafeAreaChanged,
13    /// Fullscreen or window chrome transition.
14    FullscreenChanged,
15    /// Lifecycle first-frame presentation request (must draw immediately without advancing simulation time).
16    LifecycleFirstFrame,
17    /// Display refresh mode or foreground resume requiring a clean time-base rebase.
18    TimebaseReset,
19}
20
21/// Authoritative pacing verdict emitted by `FramePacingController::evaluate`.
22#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
23pub enum PacingAction {
24    /// Advance fixed simulation by `sim_dt_secs` and submit at most one complete frame for this VSync.
25    #[default]
26    StepAndRender,
27    /// Present a fresh visual frame without advancing simulation time (used for lifecycle first frames).
28    RenderWithoutSimAdvance,
29    /// Record pending input/layout dirtiness and wait for the next VSync without double-stepping simulation.
30    DeferToNextVsync,
31    /// Defer submission because `in_flight_frames >= max_in_flight_frames`.
32    WaitInFlight,
33    /// Skip this presentation opportunity to respect an explicit user FPS cap below the display refresh rate.
34    SkipUserCap,
35}