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>,
}vulkan only.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 moreSource§unsafe fn delete_swapchain(self: Box<Self>)
unsafe fn delete_swapchain(self: Box<Self>)
Source§unsafe fn acquire(
&mut self,
timeout: Option<Duration>,
fence: &Fence,
) -> Result<AcquiredSurfaceTexture<Vulkan>, SurfaceError>
unsafe fn acquire( &mut self, timeout: Option<Duration>, fence: &Fence, ) -> Result<AcquiredSurfaceTexture<Vulkan>, SurfaceError>
Source§unsafe fn discard_texture(
&mut self,
_texture: SurfaceTexture,
) -> Result<(), SurfaceError>
unsafe fn discard_texture( &mut self, _texture: SurfaceTexture, ) -> Result<(), SurfaceError>
Source§unsafe fn present(
&mut self,
queue: &Queue,
texture: SurfaceTexture,
) -> Result<(), SurfaceError>
unsafe fn present( &mut self, queue: &Queue, texture: SurfaceTexture, ) -> Result<(), SurfaceError>
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Auto Trait Implementations§
impl Freeze for NativeSwapchain
impl !RefUnwindSafe for NativeSwapchain
impl Send for NativeSwapchain
impl Sync for NativeSwapchain
impl Unpin for NativeSwapchain
impl !UnwindSafe for NativeSwapchain
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 more