diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
commit | 47a0c0317cc774c19b78582bec9b5b09d56f569a (patch) | |
tree | d03471ea4e084ace9b95a2c5b7febb780b45bb63 /stockton-render/src/draw/queue_negotiator.rs | |
parent | fb996488aa651cb2e7f46abc083c4318b47e77cd (diff) |
feat(render): draw passes
Diffstat (limited to 'stockton-render/src/draw/queue_negotiator.rs')
-rw-r--r-- | stockton-render/src/draw/queue_negotiator.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/stockton-render/src/draw/queue_negotiator.rs b/stockton-render/src/draw/queue_negotiator.rs index b39678f..65c7aa4 100644 --- a/stockton-render/src/draw/queue_negotiator.rs +++ b/stockton-render/src/draw/queue_negotiator.rs @@ -12,6 +12,7 @@ use std::{ pub struct QueueNegotiator { family_ids: HashMap<TypeId, QueueFamilyId>, already_allocated: HashMap<TypeId, (Vec<Arc<RwLock<QueueT>>>, usize)>, + all: Vec<QueueGroup>, } /// Can be used to select a specific queue family @@ -25,6 +26,7 @@ impl QueueNegotiator { QueueNegotiator { family_ids: HashMap::new(), already_allocated: HashMap::new(), + all: vec![], } } @@ -57,20 +59,23 @@ impl QueueNegotiator { Ok(()) } - pub fn get_queue<T: QueueFamilySelector>( - &mut self, - groups: &mut Vec<QueueGroup>, - ) -> Option<Arc<RwLock<QueueT>>> { + pub fn set_queue_groups(&mut self, queue_groups: Vec<QueueGroup>) { + self.all = queue_groups + } + + pub fn get_queue<T: QueueFamilySelector>(&mut self) -> Option<Arc<RwLock<QueueT>>> { let tid = TypeId::of::<T>(); let family_id = self.family_ids.get(&tid)?; - - match groups + log::debug!("{:?}", self.all); + log::debug!("{:?}", self.already_allocated); + match self + .all .iter() .position(|x| !x.queues.is_empty() && x.family == *family_id) { Some(idx) => { // At least one remaining queue - let queue = groups[idx].queues.pop().unwrap(); + let queue = self.all[idx].queues.pop().unwrap(); let queue = Arc::new(RwLock::new(queue)); self.add_to_allocated::<T>(queue.clone()); |