Struct Swapchain

Source
struct Swapchain {
    raw: SwapchainKHR,
    functor: Device,
    device: Arc<DeviceShared>,
    images: Vec<Image>,
    config: SurfaceConfiguration,
    acquire_semaphores: Vec<Arc<Mutex<SwapchainAcquireSemaphore>>>,
    next_acquire_index: usize,
    present_semaphores: Vec<Arc<Mutex<SwapchainPresentSemaphores>>>,
    next_present_time: Option<PresentTimeGOOGLE>,
}
Available on vulkan only.

Fields§

§raw: SwapchainKHR§functor: Device§device: Arc<DeviceShared>§images: Vec<Image>§config: SurfaceConfiguration§acquire_semaphores: Vec<Arc<Mutex<SwapchainAcquireSemaphore>>>

Semaphores used between image acquisition and the first submission that uses that image. This is indexed using next_acquire_index.

Because we need to provide this to vkAcquireNextImageKHR, we haven’t received the swapchain image index for the frame yet, so we cannot use that to index it.

Before we pass this to vkAcquireNextImageKHR, we ensure that we wait on the submission indicated by previously_used_submission_index. This enusres the semaphore is no longer in use before we use it.

§next_acquire_index: usize

The index of the next acquire semaphore to use.

This is incremented each time we acquire a new image, and wraps around to 0 when it reaches the end of acquire_semaphores.

§present_semaphores: Vec<Arc<Mutex<SwapchainPresentSemaphores>>>

Semaphore sets used between all submissions that write to an image and the presentation of that image.

This is indexed by the swapchain image index returned by vkAcquireNextImageKHR.

We know it is safe to use these semaphores because use them after the acquire semaphore. Because the acquire semaphore has been signaled, the previous presentation using that image is known-finished, so this semaphore is no longer in use.

§next_present_time: Option<PresentTimeGOOGLE>

The present timing information which will be set in the next call to present().

§Safety

This must only be set if [wgt::Features::VULKAN_GOOGLE_DISPLAY_TIMING] is enabled, and so the VK_GOOGLE_display_timing extension is present.

Implementations§

Source§

impl Swapchain

Source

unsafe fn release_resources(self, device: &Device) -> Self

§Safety
  • The device must have been made idle before calling this function.
Source§

impl Swapchain

Source

fn advance_acquire_semaphore(&mut self)

Mark the current frame finished, advancing to the next acquire semaphore.

Source

fn get_acquire_semaphore(&self) -> Arc<Mutex<SwapchainAcquireSemaphore>>

Get the next acquire semaphore that should be used with this swapchain.

Source

fn get_present_semaphores( &self, index: u32, ) -> Arc<Mutex<SwapchainPresentSemaphores>>

Get the set of present semaphores that should be used with the given image index.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,