pub(super) trait Swapchain:
Send
+ Sync
+ 'static {
// Required methods
unsafe fn release_resources(&mut self, device: &Device);
unsafe fn delete_swapchain(self: Box<Self>);
unsafe fn acquire(
&mut self,
timeout: Option<Duration>,
fence: &Fence,
) -> Result<Option<AcquiredSurfaceTexture<Vulkan>>, SurfaceError>;
unsafe fn discard_texture(
&mut self,
texture: SurfaceTexture,
) -> Result<(), SurfaceError>;
unsafe fn present(
&mut self,
queue: &Queue,
texture: SurfaceTexture,
) -> Result<(), SurfaceError>;
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
}Required Methods§
Sourceunsafe fn release_resources(&mut self, device: &Device)
unsafe fn release_resources(&mut self, device: &Device)
Releases all resources associated with the swapchain, without
destroying the swapchain itself. Must be called before calling
either Surface::create_swapchain or Swapchain::delete_swapchain.
The swapchain must not be in use when this is called.
Sourceunsafe fn delete_swapchain(self: Box<Self>)
unsafe fn delete_swapchain(self: Box<Self>)
Deletes the swapchain.
The swapchain must not be in use when it is deleted and
Swapchain::release_resources must have been called first.
Sourceunsafe fn acquire(
&mut self,
timeout: Option<Duration>,
fence: &Fence,
) -> Result<Option<AcquiredSurfaceTexture<Vulkan>>, SurfaceError>
unsafe fn acquire( &mut self, timeout: Option<Duration>, fence: &Fence, ) -> Result<Option<AcquiredSurfaceTexture<Vulkan>>, SurfaceError>
Acquires the next available surface texture for rendering.
timeout specifies the maximum time to wait for an image to become available.
If None is specified, this function will wait indefinitely.
Returns Ok(None) if the timeout elapsed before an image became available.
Sourceunsafe fn discard_texture(
&mut self,
texture: SurfaceTexture,
) -> Result<(), SurfaceError>
unsafe fn discard_texture( &mut self, texture: SurfaceTexture, ) -> Result<(), SurfaceError>
Tries to discard the acquired texture without presenting it.
In practice, this doesn’t really work in the current implementations.
Sourceunsafe fn present(
&mut self,
queue: &Queue,
texture: SurfaceTexture,
) -> Result<(), SurfaceError>
unsafe fn present( &mut self, queue: &Queue, texture: SurfaceTexture, ) -> Result<(), SurfaceError>
Presents the given surface texture using the queue.
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Allows downcasting to the concrete type mutably.