From 47a0c0317cc774c19b78582bec9b5b09d56f569a Mon Sep 17 00:00:00 2001 From: tcmal Date: Sun, 25 Aug 2024 17:44:23 +0100 Subject: feat(render): draw passes --- stockton-render/src/draw/queue_negotiator.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'stockton-render/src/draw/queue_negotiator.rs') 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, already_allocated: HashMap>>, usize)>, + all: Vec, } /// 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( - &mut self, - groups: &mut Vec, - ) -> Option>> { + pub fn set_queue_groups(&mut self, queue_groups: Vec) { + self.all = queue_groups + } + + pub fn get_queue(&mut self) -> Option>> { let tid = TypeId::of::(); 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::(queue.clone()); -- cgit v1.2.3