Skip to content

Commit 6cec29d

Browse files
mockersfkirusfg
authored andcommitted
update doc
1 parent 9863daf commit 6cec29d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

crates/bevy_window/src/window.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ use raw_window_handle::RawWindowHandle;
55
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
66
pub struct WindowId(Uuid);
77

8+
/// Presentation mode for a window.
9+
///
10+
/// The presentation mode specifies when a frame is presented to the window. The `Fifo`
11+
/// option corresponds to a traditional `VSync`, where the framerate is capped by the
12+
/// display refresh rate. Both `Immediate` and `Mailbox` are low-latency and are not
13+
/// capped by the refresh rate, but may not be available on all platforms. Tearing
14+
/// may be observed with `Immediate` mode, but will not be observed with `Mailbox` or
15+
/// `Fifo`.
16+
///
17+
/// `Immediate` or `Mailbox` will gracefully fallback to `Fifo` when unavailable.
18+
///
19+
/// The presentation mode may be declared in the
20+
/// [`WindowSetupDescriptor`](WindowSetupDescriptor::present_mode) or updated on a
21+
/// [`Window`](Window::set_present_mode).
22+
#[repr(C)]
23+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
24+
#[doc(alias = "vsync")]
25+
pub enum PresentMode {
26+
/// The presentation engine does **not** wait for a vertical blanking period and
27+
/// the request is presented immediately. This is a low-latency presentation mode,
28+
/// but visible tearing may be observed. Will fallback to `Fifo` if unavailable on the
29+
/// selected platform and backend. Not optimal for mobile.
30+
Immediate = 0,
31+
/// The presentation engine waits for the next vertical blanking period to update
32+
/// the current image, but frames may be submitted without delay. This is a low-latency
33+
/// presentation mode and visible tearing will **not** be observed. Will fallback to `Fifo`
34+
/// if unavailable on the selected platform and backend. Not optimal for mobile.
35+
Mailbox = 1,
36+
/// The presentation engine waits for the next vertical blanking period to update
37+
/// the current image. The framerate will be capped at the display refresh rate,
38+
/// corresponding to the `VSync`. Tearing cannot be observed. Optimal for mobile.
39+
Fifo = 2, // NOTE: The explicit ordinal values mirror wgpu and the vulkan spec.
40+
}
41+
842
impl WindowId {
943
pub fn new() -> Self {
1044
WindowId(Uuid::new_v4())

0 commit comments

Comments
 (0)