Struct demo_vk::graphics::vulkan::FramesInFlight
source · pub struct FramesInFlight { /* private fields */ }Expand description
The primary synchronization mechanism for managing multiple in-flight frames.
There can be 1-N frames in flight for the application, decided at the time of construction. This is independent from the number of swapchain images, though there is little-to-no benefit to having more frames in flight than swapchain images.
Synchronization is performed such that when Self::start_frame returns, all commands submitted to that frame are guaranteed to be complete. Thus, the application can keep N copies of a resource and use the frame_index to prevent synchronization errors.
Implementations§
source§impl FramesInFlight
impl FramesInFlight
sourcepub fn new(cxt: Arc<VulkanContext>, frame_count: usize) -> Result<Self>
pub fn new(cxt: Arc<VulkanContext>, frame_count: usize) -> Result<Self>
Creates a new instance with frame_count frames.
sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Get the total number of configured frames in flight.
sourcepub fn wait_for_all_frames_to_complete(&self) -> Result<()>
pub fn wait_for_all_frames_to_complete(&self) -> Result<()>
Blocks until all submitted commands for all frames have completed.
sourcepub fn start_frame(&mut self, swapchain: &Swapchain) -> Result<FrameStatus>
pub fn start_frame(&mut self, swapchain: &Swapchain) -> Result<FrameStatus>
Starts the next frame in flight.
This method can block if all frames are in flight. It will block until the next frame is available.
§Returns
A FrameStatus containing one of:
- A Frame that must be returned to Self::present_frame
- A flag indicating that the Swapchain needs to be rebuilt before the next frame.
sourcepub fn present_frame(
&mut self,
swapchain: &Swapchain,
frame: Frame,
) -> Result<PresentImageStatus>
pub fn present_frame( &mut self, swapchain: &Swapchain, frame: Frame, ) -> Result<PresentImageStatus>
Queues the Frame’s command buffer and swapchain presentation.
Trait Implementations§
source§impl Debug for FramesInFlight
impl Debug for FramesInFlight
Auto Trait Implementations§
impl Freeze for FramesInFlight
impl !RefUnwindSafe for FramesInFlight
impl Send for FramesInFlight
impl Sync for FramesInFlight
impl Unpin for FramesInFlight
impl !UnwindSafe for FramesInFlight
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> 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> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.