use std::{fmt, ops::Deref};
use crate::generic::{DeviceError, OutOfMemory, PipelineStages};
use super::{CommandBuffer, CommandEncoder, Device, Frame};
pub struct Queue {
device: Device,
}
unsafe impl Send for Queue {}
unsafe impl Sync for Queue {}
impl fmt::Debug for Queue {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Queue")
.field("device", &self.device)
.finish()
}
}
impl Queue {
pub(super) fn new(device: Device) -> Self {
Queue {
device,
}
}
}
impl Deref for Queue {
type Target = Device;
#[inline(always)]
fn deref(&self) -> &Device {
&self.device
}
}
#[hidden_trait::expose]
impl crate::traits::Queue for Queue {
fn device(&self) -> &Device {
&self.device
}
fn family(&self) -> u32 {
0
}
fn new_command_encoder(&mut self) -> Result<CommandEncoder, OutOfMemory> {
Ok(CommandEncoder::new(self.device.clone()))
}
fn submit<I>(&mut self, command_buffers: I, _check_point: bool) -> Result<(), DeviceError>
where
I: IntoIterator<Item = CommandBuffer>,
{
Ok(())
}
fn drop_command_buffer<I>(&mut self, command_buffers: I)
where
I: IntoIterator<Item = CommandBuffer>,
{
}
fn sync_frame(&mut self, _frame: &mut Frame, _before: PipelineStages) {
}
fn wait_idle(&self) -> Result<(), OutOfMemory> {
Ok(())
}
}