pebble/ecs/system.rs
1/// When a system runs, each tick. Stages run in the order listed here.
2#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
3pub enum SystemStage {
4 /// Once, before anything else — no GPU backend yet, pure CPU setup.
5 Startup,
6 /// Once, automatically, the first tick the GPU backend is ready. For
7 /// one-time setup that needs `Backend`/`Assets<T>` — a plain
8 /// `Read<Backend>` here is always safe, no `Option` guard needed.
9 Ready,
10 /// Uploads CPU-side assets to the GPU, retrying until dependencies are met.
11 AssetSync,
12 /// Before main game logic (input, timers, event aging).
13 PreUpdate,
14 /// Main game logic.
15 Update,
16 /// After main game logic.
17 PostUpdate,
18 /// Acquire the frame.
19 PreRender,
20 /// Issue draw calls.
21 Render,
22 /// Submit and present.
23 PostRender,
24}
25
26/// Priority engine-owned `Ready` systems (built-in plugins like
27/// `GraphicsPlugin`) should register with, via `.priority(ENGINE_READY_PRIORITY)`
28/// — guarantees they run before user `Ready` systems left at the default
29/// priority (0), so engine resources (`GlobalSamplers`, etc.) are already
30/// present for any user setup that runs the same tick. An explicit
31/// `.after(...)`/`.before(...)` on a user system still overrides this, same
32/// as any other priority tie-break.
33pub const ENGINE_READY_PRIORITY: i32 = i32::MAX;