Struct vulkano::sync::FenceSignalFuture
source · pub struct FenceSignalFuture<F>where
F: GpuFuture,{ /* private fields */ }
Expand description
Represents a fence being signaled after a previous event.
Contrary to most other future types, it is possible to block the current thread until the event
happens. This is done by calling the wait()
function.
This can also be done through Rust’s Async system by simply .await
ing this object. Note though
that (due to the Vulkan API fence design) this will spin to check the fence, rather than
blocking in the driver. Therefore if you have a long-running task, blocking may be less
CPU intense (depending on the driver’s implementation).
Also note that the GpuFuture
trait is implemented on Arc<FenceSignalFuture<_>>
.
This means that you can put this future in an Arc
and keep a copy of it somewhere in order
to know when the execution reached that point.
use std::sync::Arc;
use vulkano::sync::GpuFuture;
// Assuming you have a chain of operations, like this:
// let future = ...
// .then_execute(foo)
// .then_execute(bar)
// You can signal a fence at this point of the chain, and put the future in an `Arc`.
let fence_signal = Arc::new(future.then_signal_fence());
// And then continue the chain:
// fence_signal.clone()
// .then_execute(baz)
// .then_execute(qux)
// Later you can wait until you reach the point of `fence_signal`:
fence_signal.wait(None).unwrap();
Implementations
sourceimpl<F> FenceSignalFuture<F>where
F: GpuFuture,
impl<F> FenceSignalFuture<F>where
F: GpuFuture,
sourcepub fn is_signaled(&self) -> Result<bool, OomError>
pub fn is_signaled(&self) -> Result<bool, OomError>
Returns true if the fence is signaled by the GPU.
sourcepub fn wait(&self, timeout: Option<Duration>) -> Result<(), FlushError>
pub fn wait(&self, timeout: Option<Duration>) -> Result<(), FlushError>
Blocks the current thread until the fence is signaled by the GPU. Performs a flush if necessary.
If timeout
is None
, then the wait is infinite. Otherwise the thread will unblock after
the specified timeout has elapsed and an error will be returned.
If the wait is successful, this function also cleans any resource locked by previous submissions.
Trait Implementations
sourceimpl<F> DeviceOwned for FenceSignalFuture<F>where
F: GpuFuture,
impl<F> DeviceOwned for FenceSignalFuture<F>where
F: GpuFuture,
sourceimpl<F> Drop for FenceSignalFuture<F>where
F: GpuFuture,
impl<F> Drop for FenceSignalFuture<F>where
F: GpuFuture,
sourceimpl<F> Future for FenceSignalFuture<F>where
F: GpuFuture,
impl<F> Future for FenceSignalFuture<F>where
F: GpuFuture,
sourceimpl<F> GpuFuture for FenceSignalFuture<F>where
F: GpuFuture,
impl<F> GpuFuture for FenceSignalFuture<F>where
F: GpuFuture,
sourcefn cleanup_finished(&mut self)
fn cleanup_finished(&mut self)
sourceunsafe fn build_submission(&self) -> Result<SubmitAnyBuilder, FlushError>
unsafe fn build_submission(&self) -> Result<SubmitAnyBuilder, FlushError>
GpuFuture
will happen, and possibly contains extra elements (eg. a semaphore wait or an
event wait) that makes the dependency with subsequent operations work. Read moresourcefn flush(&self) -> Result<(), FlushError>
fn flush(&self) -> Result<(), FlushError>
sourceunsafe fn signal_finished(&self)
unsafe fn signal_finished(&self)
sourcefn queue_change_allowed(&self) -> bool
fn queue_change_allowed(&self) -> bool
true
if elements submitted after this future can be submitted to a different
queue than the other returned by queue()
. Read moresourcefn queue(&self) -> Option<Arc<Queue>>
fn queue(&self) -> Option<Arc<Queue>>
None
if unknown or irrelevant. Read moresourcefn check_buffer_access(
&self,
buffer: &Buffer,
range: Range<DeviceSize>,
exclusive: bool,
queue: &Queue
) -> Result<Option<(PipelineStages, AccessFlags)>, AccessCheckError>
fn check_buffer_access(
&self,
buffer: &Buffer,
range: Range<DeviceSize>,
exclusive: bool,
queue: &Queue
) -> Result<Option<(PipelineStages, AccessFlags)>, AccessCheckError>
sourcefn check_image_access(
&self,
image: &Image,
range: Range<DeviceSize>,
exclusive: bool,
expected_layout: ImageLayout,
queue: &Queue
) -> Result<Option<(PipelineStages, AccessFlags)>, AccessCheckError>
fn check_image_access(
&self,
image: &Image,
range: Range<DeviceSize>,
exclusive: bool,
expected_layout: ImageLayout,
queue: &Queue
) -> Result<Option<(PipelineStages, AccessFlags)>, AccessCheckError>
sourcefn check_swapchain_image_acquired(
&self,
swapchain: &Swapchain,
image_index: u32,
_before: bool
) -> Result<(), AccessCheckError>
fn check_swapchain_image_acquired(
&self,
swapchain: &Swapchain,
image_index: u32,
_before: bool
) -> Result<(), AccessCheckError>
sourcefn join<F>(self, other: F) -> JoinFuture<Self, F>where
Self: Sized,
F: GpuFuture,
fn join<F>(self, other: F) -> JoinFuture<Self, F>where
Self: Sized,
F: GpuFuture,
sourcefn then_execute<Cb>(
self,
queue: Arc<Queue>,
command_buffer: Cb
) -> Result<CommandBufferExecFuture<Self>, CommandBufferExecError>where
Self: Sized,
Cb: PrimaryCommandBufferAbstract + 'static,
fn then_execute<Cb>(
self,
queue: Arc<Queue>,
command_buffer: Cb
) -> Result<CommandBufferExecFuture<Self>, CommandBufferExecError>where
Self: Sized,
Cb: PrimaryCommandBufferAbstract + 'static,
sourcefn then_execute_same_queue<Cb>(
self,
command_buffer: Cb
) -> Result<CommandBufferExecFuture<Self>, CommandBufferExecError>where
Self: Sized,
Cb: PrimaryCommandBufferAbstract + 'static,
fn then_execute_same_queue<Cb>(
self,
command_buffer: Cb
) -> Result<CommandBufferExecFuture<Self>, CommandBufferExecError>where
Self: Sized,
Cb: PrimaryCommandBufferAbstract + 'static,
sourcefn then_signal_semaphore(self) -> SemaphoreSignalFuture<Self>where
Self: Sized,
fn then_signal_semaphore(self) -> SemaphoreSignalFuture<Self>where
Self: Sized,
sourcefn then_signal_semaphore_and_flush(
self
) -> Result<SemaphoreSignalFuture<Self>, FlushError>where
Self: Sized,
fn then_signal_semaphore_and_flush(
self
) -> Result<SemaphoreSignalFuture<Self>, FlushError>where
Self: Sized,
sourcefn then_signal_fence(self) -> FenceSignalFuture<Self>ⓘNotable traits for FenceSignalFuture<F>impl<F> Future for FenceSignalFuture<F>where
F: GpuFuture, type Output = Result<(), OomError>;
where
Self: Sized,
fn then_signal_fence(self) -> FenceSignalFuture<Self>ⓘNotable traits for FenceSignalFuture<F>impl<F> Future for FenceSignalFuture<F>where
F: GpuFuture, type Output = Result<(), OomError>;
where
Self: Sized,
F: GpuFuture, type Output = Result<(), OomError>;