Merge pull request #446 from tomaka/dummy-to-now

Rename DummyFuture to NowFuture
This commit is contained in:
tomaka 2017-05-08 12:40:06 +02:00 committed by GitHub
commit 2b39c8be87
4 changed files with 21 additions and 22 deletions

View File

@ -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<Queue>) -> CommandBufferExecFuture<DummyFuture, Self>
fn execute(self, queue: Arc<Queue>) -> CommandBufferExecFuture<NowFuture, Self>
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.

View File

@ -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;

View File

@ -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<Device>,
}
impl DummyFuture {
/// Builds a new dummy future.
#[inline]
pub fn new(device: Arc<Device>) -> DummyFuture {
DummyFuture {
device: device,
}
/// Builds a future that represents "now".
#[inline]
pub fn now(device: Arc<Device>) -> NowFuture {
NowFuture {
device: device,
}
}
unsafe impl GpuFuture for DummyFuture {
/// A dummy future that represents "now".
pub struct NowFuture {
device: Arc<Device>,
}
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<Device> {
&self.device

View File

@ -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;