pub(super) trait Surface: Send + Sync + 'static { /// Returns the surface capabilities for the given adapter. /// /// Returns `None` if the surface is not compatible with the adapter. fn surface_capabilities(&self, adapter: &super::Adapter) -> Option<crate::SurfaceCapabilities>;
/// Creates a swapchain for the surface with the given configuration. /// /// If this is not the first swapchain created for the surface, the old swapchain /// must be provided. [`Swapchain::release_resources`] must be called on the old swapchain /// before calling this method. unsafefn create_swapchain(
&self,
device: &super::Device,
config: &crate::SurfaceConfiguration,
provided_old_swapchain: Option<Box<dyn Swapchain>>,
) -> Result<Box<dyn Swapchain>, crate::SurfaceError>;
/// Allows downcasting to the concrete type. fn as_any(&self) -> &dyn Any;
}
pub(super) trait Swapchain: Send + Sync + 'static { /// Releases all resources associated with the swapchain, without /// destroying the swapchain itself. Must be called before calling /// either [`Surface::create_swapchain`] or dropping the swapchain. /// /// The swapchain must not be in use when this is called. unsafefn release_resources(&mutself, device: &super::Device);
/// 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 `Err(SurfaceError::Timeout)` if the timeout elapsed before an image became available. unsafefn acquire(
&mutself,
timeout: Option<Duration>,
fence: &super::Fence,
) -> Result<crate::AcquiredSurfaceTexture<crate::api::Vulkan>, crate::SurfaceError>;
/// Tries to discard the acquired texture without presenting it. /// /// In practice, this doesn't really work in the current implementations. unsafefn discard_texture(
&mutself,
texture: super::SurfaceTexture,
) -> Result<(), crate::SurfaceError>;
/// Presents the given surface texture using the queue. unsafefn present(
&mutself,
queue: &super::Queue,
texture: crate::vulkan::SurfaceTexture,
) -> Result<(), crate::SurfaceError>;
/// Allows downcasting to the concrete type. fn as_any(&self) -> &dyn Any;
/// Allows downcasting to the concrete type mutably. fn as_any_mut(&mutself) -> &mutdyn Any;
}
/// Swapchain specific metadata associated with a surface texture. pub(super) trait SurfaceTextureMetadata: Debug + Send + Sync + 'static { /// Returns a guard which can yield the semaphores needed for submission using this swapchain texture. fn get_semaphore_guard(&self) -> Box<dyn SwapchainSubmissionSemaphoreGuard + '_>;
/// Allows downcasting to the concrete type. fn as_any(&self) -> &dyn Any;
}
/// Guard type for managing swapchain submission semaphores. pub(super) trait SwapchainSubmissionSemaphoreGuard { /// Sets the Fence value for this submission. fn set_used_fence_value(&mutself, value: u64);
/// Gets semaphores to wait on before doing GPU work for this swapchain texture. fn get_acquire_wait_semaphore(&mutself) -> Option<SemaphoreType>;
/// Gets the semaphore to signal when GPU work for this swapchain texture is complete. fn get_submit_signal_semaphore(
&mutself,
device: &DeviceShared,
) -> Result<SemaphoreType, crate::DeviceError>;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.