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};
use crate::memory::{SparseBind, SparseImageBind};
#[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 Queue<B: Backend>: fmt::Debug + Any + Send + Sync {
unsafe fn bind_sparse<'a, Iw, Is, Ibi, Ib, Iii, Io, Ii>(
&mut self,
_wait_semaphores: Iw,
_signal_semaphores: Is,
_buffer_memory_binds: Ib,
_image_opaque_memory_binds: Io,
_image_memory_binds: Ii,
_device: &B::Device,
_fence: Option<&B::Fence>,
) where
Ibi: Iterator<Item = &'a SparseBind<&'a B::Memory>>,
Ib: Iterator<Item = (&'a mut B::Buffer, Ibi)>,
Iii: Iterator<Item = &'a SparseImageBind<&'a B::Memory>>,
Io: Iterator<Item = (&'a mut B::Image, Ibi)>,
Ii: Iterator<Item = (&'a mut B::Image, Iii)>,
Iw: Iterator<Item = &'a B::Semaphore>,
Is: Iterator<Item = &'a B::Semaphore>,
{
unimplemented!()
}
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>;
fn timestamp_period(&self) -> f32;
}