#[repr(C)]pub enum PresentMode {
AutoVsync = 0,
AutoNoVsync = 1,
Fifo = 2,
FifoRelaxed = 3,
Immediate = 4,
Mailbox = 5,
}
Expand description
Timing and queueing with which frames are actually displayed to the user.
Use this as part of a SurfaceConfiguration
to control the behavior of
SurfaceTexture::present()
.
Some modes are only supported by some backends.
You can use one of the Auto*
modes, Fifo
,
or choose one of the supported modes from SurfaceCapabilities::present_modes
.
Variants§
AutoVsync = 0
Chooses the first supported mode out of:
Because of the fallback behavior, this is supported everywhere.
AutoNoVsync = 1
Chooses the first supported mode out of:
Because of the fallback behavior, this is supported everywhere.
Fifo = 2
Presentation frames are kept in a First-In-First-Out queue approximately 3 frames long. Every vertical blanking period, the presentation engine will pop a frame off the queue to display. If there is no frame to display, it will present the same frame again until the next vblank.
When a present command is executed on the GPU, the presented image is added on the queue.
Calls to Surface::get_current_texture()
will block until there is a spot in the queue.
- Tearing: No tearing will be observed.
- Supported on: All platforms.
- Also known as: “Vsync On”
This is the default value for PresentMode
.
If you don’t know what mode to choose, choose this mode.
FifoRelaxed = 3
Presentation frames are kept in a First-In-First-Out queue approximately 3 frames long. Every vertical blanking period, the presentation engine will pop a frame off the queue to display. If there is no frame to display, it will present the same frame until there is a frame in the queue. The moment there is a frame in the queue, it will immediately pop the frame off the queue.
When a present command is executed on the GPU, the presented image is added on the queue.
Calls to Surface::get_current_texture()
will block until there is a spot in the queue.
- Tearing: Tearing will be observed if frames last more than one vblank as the front buffer.
- Supported on: AMD on Vulkan.
- Also known as: “Adaptive Vsync”
Immediate = 4
Presentation frames are not queued at all. The moment a present command is executed on the GPU, the presented image is swapped onto the front buffer immediately.
- Tearing: Tearing can be observed.
- Supported on: Most platforms except older DX12 and Wayland.
- Also known as: “Vsync Off”
Mailbox = 5
Presentation frames are kept in a single-frame queue. Every vertical blanking period, the presentation engine will pop a frame from the queue. If there is no frame to display, it will present the same frame again until the next vblank.
When a present command is executed on the GPU, the frame will be put into the queue. If there was already a frame in the queue, the new frame will replace the old frame on the queue.
- Tearing: No tearing will be observed.
- Supported on: DX12 on Windows 10, NVidia on Vulkan and Wayland on Vulkan.
- Also known as: “Fast Vsync”
Trait Implementations§
Source§impl Clone for PresentMode
impl Clone for PresentMode
Source§fn clone(&self) -> PresentMode
fn clone(&self) -> PresentMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PresentMode
impl Debug for PresentMode
Source§impl Default for PresentMode
impl Default for PresentMode
Source§fn default() -> PresentMode
fn default() -> PresentMode
Source§impl<'de> Deserialize<'de> for PresentMode
impl<'de> Deserialize<'de> for PresentMode
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PresentMode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PresentMode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for PresentMode
impl Hash for PresentMode
Source§impl PartialEq for PresentMode
impl PartialEq for PresentMode
Source§impl Serialize for PresentMode
impl Serialize for PresentMode
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for PresentMode
impl Eq for PresentMode
impl StructuralPartialEq for PresentMode
Auto Trait Implementations§
impl Freeze for PresentMode
impl RefUnwindSafe for PresentMode
impl Send for PresentMode
impl Sync for PresentMode
impl Unpin for PresentMode
impl UnwindSafe for PresentMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.