diff --git a/vulkano/src/command_buffer/traits.rs b/vulkano/src/command_buffer/traits.rs index d786b13f..5b245616 100644 --- a/vulkano/src/command_buffer/traits.rs +++ b/vulkano/src/command_buffer/traits.rs @@ -23,8 +23,9 @@ use device::DeviceOwned; use device::Queue; use image::ImageAccess; use instance::QueueFamily; +use sync::now; use sync::AccessFlagBits; -use sync::DummyFuture; +use sync::NowFuture; use sync::GpuFuture; use sync::PipelineStages; use SafeDeref; @@ -63,17 +64,17 @@ pub unsafe trait CommandBuffer: DeviceOwned { /// > **Note**: In the future this function may return `-> impl GpuFuture` instead of a /// > concrete type. /// - /// > **Note**: This is just a shortcut for `execute_after`. + /// > **Note**: This is just a shortcut for `execute_after(vulkano::sync::now(), queue)`. /// /// # Panic /// /// Panics if the device of the command buffer is not the same as the device of the future. #[inline] - fn execute(self, queue: Arc) -> CommandBufferExecFuture + fn execute(self, queue: Arc) -> CommandBufferExecFuture where Self: Sized + 'static { let device = queue.device().clone(); - self.execute_after(DummyFuture::new(device), queue) + self.execute_after(now(device), queue) } /// Executes the command buffer after an existing future. diff --git a/vulkano/src/sync/future/mod.rs b/vulkano/src/sync/future/mod.rs index e209138f..2742cf5e 100644 --- a/vulkano/src/sync/future/mod.rs +++ b/vulkano/src/sync/future/mod.rs @@ -22,12 +22,12 @@ use swapchain::PresentFuture; use sync::AccessFlagBits; use sync::PipelineStages; -pub use self::dummy::DummyFuture; +pub use self::now::{now, NowFuture}; pub use self::fence_signal::FenceSignalFuture; pub use self::join::JoinFuture; pub use self::semaphore_signal::SemaphoreSignalFuture; -mod dummy; +mod now; mod fence_signal; mod join; mod semaphore_signal; diff --git a/vulkano/src/sync/future/dummy.rs b/vulkano/src/sync/future/now.rs similarity index 85% rename from vulkano/src/sync/future/dummy.rs rename to vulkano/src/sync/future/now.rs index 1342034b..472822a6 100644 --- a/vulkano/src/sync/future/dummy.rs +++ b/vulkano/src/sync/future/now.rs @@ -20,23 +20,20 @@ use sync::AccessFlagBits; use sync::GpuFuture; use sync::PipelineStages; -/// A dummy future that represents "now". -#[must_use] -pub struct DummyFuture { - device: Arc, -} - -impl DummyFuture { - /// Builds a new dummy future. - #[inline] - pub fn new(device: Arc) -> DummyFuture { - DummyFuture { - device: device, - } +/// Builds a future that represents "now". +#[inline] +pub fn now(device: Arc) -> NowFuture { + NowFuture { + device: device, } } -unsafe impl GpuFuture for DummyFuture { +/// A dummy future that represents "now". +pub struct NowFuture { + device: Arc, +} + +unsafe impl GpuFuture for NowFuture { #[inline] fn cleanup_finished(&mut self) { } @@ -80,7 +77,7 @@ unsafe impl GpuFuture for DummyFuture { } } -unsafe impl DeviceOwned for DummyFuture { +unsafe impl DeviceOwned for NowFuture { #[inline] fn device(&self) -> &Arc { &self.device diff --git a/vulkano/src/sync/mod.rs b/vulkano/src/sync/mod.rs index 8fadff68..901b108a 100644 --- a/vulkano/src/sync/mod.rs +++ b/vulkano/src/sync/mod.rs @@ -109,7 +109,8 @@ use device::Queue; pub use self::event::Event; pub use self::fence::Fence; pub use self::fence::FenceWaitError; -pub use self::future::DummyFuture; +pub use self::future::now; +pub use self::future::NowFuture; pub use self::future::GpuFuture; pub use self::future::SemaphoreSignalFuture; pub use self::future::FenceSignalFuture;