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
use crate::queue::{QueueFamily, Queues};
use crate::Backend;
use std::collections::HashMap;
use std::hash::BuildHasherDefault;
use fxhash::FxHasher;
#[derive(Debug)]
pub struct RawQueueGroup<B: Backend> {
pub family: B::QueueFamily,
pub queues: Vec<B::CommandQueue>,
}
impl<B: Backend> RawQueueGroup<B> {
pub fn new(family: B::QueueFamily) -> Self {
RawQueueGroup {
family,
queues: Vec::new(),
}
}
pub fn add_queue(&mut self, queue: B::CommandQueue) {
assert!(self.queues.len() < self.family.max_queues());
self.queues.push(queue);
}
}
impl<B: Backend> Queues<B> {
pub fn new(queues: Vec<RawQueueGroup<B>>) -> Self {
Queues(queues)
}
}
pub type FastHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;