#[repr(C)]pub enum PresentMode {
AutoVsync = 0,
AutoNoVsync = 1,
Fifo = 2,
FifoRelaxed = 3,
Immediate = 4,
Mailbox = 5,
}
Expand description
Behavior of the presentation engine based on frame rate.
Variants§
AutoVsync = 0
Chooses FifoRelaxed -> Fifo based on availability.
Because of the fallback behavior, it is supported everywhere.
AutoNoVsync = 1
Chooses Immediate -> Mailbox -> Fifo (on web) based on availability.
Because of the fallback behavior, it 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.
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 = 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.
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 = 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 can be observed.
Supported on most platforms except older DX12 and Wayland.
This is traditionally called “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.
No tearing will be observed.
Supported on DX12 on Windows 10, NVidia on Vulkan and Wayland on Vulkan.
This is traditionally called “Fast Vsync”
Trait Implementations§
§impl Clone for PresentMode
impl Clone for PresentMode
§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 more§impl Debug for PresentMode
impl Debug for PresentMode
§impl Default for PresentMode
impl Default for PresentMode
§fn default() -> PresentMode
fn default() -> PresentMode
§impl Hash for PresentMode
impl Hash for PresentMode
§impl PartialEq for PresentMode
impl PartialEq for PresentMode
§fn eq(&self, other: &PresentMode) -> bool
fn eq(&self, other: &PresentMode) -> bool
self
and other
values to be equal, and is used
by ==
.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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request