Enum wgpu::PresentMode
source · [−]#[repr(C)]
pub enum PresentMode {
AutoVsync,
AutoNoVsync,
Fifo,
FifoRelaxed,
Immediate,
Mailbox,
}
Expand description
Behavior of the presentation engine based on frame rate.
Variants
AutoVsync
Chooses FifoRelaxed -> Fifo based on availability.
Because of the fallback behavior, it is supported everywhere.
AutoNoVsync
Chooses Immediate -> Mailbox -> Fifo (on web) based on availability.
Because of the fallback behavior, it is supported everywhere.
Fifo
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.
No tearing will be observed.
Calls to get_current_texture will block until there is a spot in the queue.
Supported on all platforms.
If you don’t know what mode to choose, choose this mode. This is traditionally called “Vsync On”.
FifoRelaxed
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.
Tearing will be observed if frames last more than one vblank as the front buffer.
Calls to get_current_texture will block until there is a spot in the queue.
Supported on AMD on Vulkan.
This is traditionally called “Adaptive Vsync”
Immediate
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 can be observed.
Supported on most platforms except older DX12 and Wayland.
This is traditionally called “Vsync Off”.
Mailbox
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.
No tearing will be observed.
Supported on DX11/12 on Windows 10, NVidia on Vulkan and Wayland on Vulkan.
This is traditionally called “Fast Vsync”
Trait Implementations
sourceimpl Clone for PresentMode
impl Clone for PresentMode
sourcefn clone(&self) -> PresentMode
fn clone(&self) -> PresentMode
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for PresentMode
impl Debug for PresentMode
sourceimpl Default for PresentMode
impl Default for PresentMode
sourcefn default() -> PresentMode
fn default() -> PresentMode
sourceimpl<'de> Deserialize<'de> for PresentMode
impl<'de> Deserialize<'de> for PresentMode
sourcefn 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>,
sourceimpl Hash for PresentMode
impl Hash for PresentMode
sourceimpl PartialEq<PresentMode> for PresentMode
impl PartialEq<PresentMode> for PresentMode
sourcefn eq(&self, other: &PresentMode) -> bool
fn eq(&self, other: &PresentMode) -> bool
sourceimpl Serialize for PresentMode
impl Serialize for PresentMode
sourcefn 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 StructuralEq for PresentMode
impl StructuralPartialEq for PresentMode
Auto Trait Implementations
impl RefUnwindSafe for PresentMode
impl Send for PresentMode
impl Sync for PresentMode
impl Unpin for PresentMode
impl UnwindSafe for PresentMode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.