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>,
}
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
impl Swapchain
Sourceunsafe fn release_resources(self, device: &Device) -> Self
unsafe fn release_resources(self, device: &Device) -> Self
§Safety
- The device must have been made idle before calling this function.
Source§impl Swapchain
impl Swapchain
Sourcefn advance_acquire_semaphore(&mut self)
fn advance_acquire_semaphore(&mut self)
Mark the current frame finished, advancing to the next acquire semaphore.
Sourcefn get_acquire_semaphore(&self) -> Arc<Mutex<SwapchainAcquireSemaphore>>
fn get_acquire_semaphore(&self) -> Arc<Mutex<SwapchainAcquireSemaphore>>
Get the next acquire semaphore that should be used with this swapchain.
Sourcefn get_present_semaphores(
&self,
index: u32,
) -> Arc<Mutex<SwapchainPresentSemaphores>>
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.