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
49
50
51
52
use crate::queue::QueueType;
use crate::Backend;
use std::any::Any;
use std::fmt::Debug;
pub trait QueueFamily: Debug + Any + Send + Sync {
fn queue_type(&self) -> QueueType;
fn max_queues(&self) -> usize;
fn id(&self) -> QueueFamilyId;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct QueueFamilyId(pub usize);
#[derive(Debug)]
pub struct QueueGroup<B: Backend> {
pub family: QueueFamilyId,
pub queues: Vec<B::CommandQueue>,
}
impl<B: Backend> QueueGroup<B> {
pub fn new(family: QueueFamilyId) -> Self {
QueueGroup {
family,
queues: Vec::new(),
}
}
pub fn add_queue(&mut self, queue: B::CommandQueue) {
self.queues.push(queue);
}
}