pub(crate) struct NativeSwapchain {
raw: SwapchainKHR,
functor: Device,
device: Arc<DeviceShared>,
images: Vec<Image>,
fence: Fence,
config: SurfaceConfiguration,
acquire_semaphores: Vec<Arc<Mutex<SwapchainAcquireSemaphore>>>,
next_acquire_index: usize,
present_semaphores: Vec<Arc<Mutex<SwapchainPresentSemaphores>>>,
next_present_time: Option<PresentTimeGOOGLE>,
}Fields§
§raw: SwapchainKHR§functor: Device§device: Arc<DeviceShared>§images: Vec<Image>§fence: FenceFence used to wait on the acquired 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 ensures
the semaphore is no longer in use before we use it.
next_acquire_index: usizeThe 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 NativeSwapchain
impl NativeSwapchain
pub(crate) fn as_raw(&self) -> SwapchainKHR
pub fn set_next_present_time(&mut self, present_timing: PresentTimeGOOGLE)
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.
Trait Implementations§
Source§impl Swapchain for NativeSwapchain
impl Swapchain for NativeSwapchain
Source§unsafe fn release_resources(&mut self, device: &Device)
unsafe fn release_resources(&mut self, device: &Device)
Surface::create_swapchain or Swapchain::delete_swapchain. Read more