pub mod family;
use crate::{
device::OutOfMemory,
pso,
window::{PresentError, PresentationSurface, Suboptimal},
Backend,
};
use std::{any::Any, fmt};
pub use self::family::{QueueFamily, QueueFamilyId, QueueGroup};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum QueueType {
General,
Graphics,
Compute,
Transfer,
}
impl QueueType {
pub fn supports_graphics(&self) -> bool {
match *self {
QueueType::General | QueueType::Graphics => true,
QueueType::Compute | QueueType::Transfer => false,
}
}
pub fn supports_compute(&self) -> bool {
match *self {
QueueType::General | QueueType::Graphics | QueueType::Compute => true,
QueueType::Transfer => false,
}
}
pub fn supports_transfer(&self) -> bool {
true
}
}
pub type QueuePriority = f32;
pub trait CommandQueue<B: Backend>: fmt::Debug + Any + Send + Sync {
unsafe fn submit<'a, Ic, Iw, Is>(
&mut self,
command_buffers: Ic,
wait_semaphores: Iw,
signal_semaphores: Is,
fence: Option<&mut B::Fence>,
) where
Ic: Iterator<Item = &'a B::CommandBuffer>,
Iw: Iterator<Item = (&'a B::Semaphore, pso::PipelineStage)>,
Is: Iterator<Item = &'a B::Semaphore>;
unsafe fn present(
&mut self,
surface: &mut B::Surface,
image: <B::Surface as PresentationSurface<B>>::SwapchainImage,
wait_semaphore: Option<&mut B::Semaphore>,
) -> Result<Option<Suboptimal>, PresentError>;
fn wait_idle(&mut self) -> Result<(), OutOfMemory>;
}