logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be copied, modified, or distributed except
// according to those terms.

//! Low-level builders that allow submitting an operation to a queue.
//!
//! In order to submit an operation to the GPU, you must use one of the builder structs of this
//! module. These structs are low-level and unsafe, and are mostly used to implement other parts
//! of vulkano, so you are encouraged to not use them directly.

pub use self::{
    bind_sparse::{
        SubmitBindSparseBatchBuilder, SubmitBindSparseBufferBindBuilder, SubmitBindSparseBuilder,
        SubmitBindSparseError, SubmitBindSparseImageBindBuilder,
        SubmitBindSparseImageOpaqueBindBuilder,
    },
    queue_present::{SubmitPresentBuilder, SubmitPresentError},
    queue_submit::{SubmitCommandBufferBuilder, SubmitCommandBufferError},
    semaphores_wait::SubmitSemaphoresWaitBuilder,
};

mod bind_sparse;
mod queue_present;
mod queue_submit;
mod semaphores_wait;

/// Contains all the possible submission builders.
#[derive(Debug)]
pub enum SubmitAnyBuilder<'a> {
    Empty,
    SemaphoresWait(SubmitSemaphoresWaitBuilder<'a>),
    CommandBuffer(SubmitCommandBufferBuilder<'a>),
    QueuePresent(SubmitPresentBuilder<'a>),
    BindSparse(SubmitBindSparseBuilder<'a>),
}

impl<'a> SubmitAnyBuilder<'a> {
    /// Returns true if equal to `SubmitAnyBuilder::Empty`.
    #[inline]
    pub fn is_empty(&self) -> bool {
        matches!(self, SubmitAnyBuilder::Empty)
    }
}