diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:24 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:24 +0100 |
commit | 0ddc1e39dc24cff636defbbbab974967bb5301b8 (patch) | |
tree | 7745054a2bc4030819eed3d39e0df45c94cc8b40 /stockton-skeleton/src/context.rs | |
parent | b86e97f67a07368877bd18501aebcbe80cf93118 (diff) |
fix(queues): fix validation errors & docs
Diffstat (limited to 'stockton-skeleton/src/context.rs')
-rw-r--r-- | stockton-skeleton/src/context.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/stockton-skeleton/src/context.rs b/stockton-skeleton/src/context.rs index be627f2..bbd0164 100644 --- a/stockton-skeleton/src/context.rs +++ b/stockton-skeleton/src/context.rs @@ -111,10 +111,20 @@ impl RenderingContext { // Device & Queue groups let (device_lock, queue_groups) = { // TODO: This sucks, but hal is restrictive on how we can pass this specific argument. - let queue_families_specs_real: Vec<_> = queue_families_specs - .iter() - .map(|(qf, ns)| (*qf, ns.as_slice())) - .collect(); + + // Deduplicate families & convert to specific type. + let mut queue_families_specs_real = Vec::with_capacity(queue_families_specs.len()); + for (qf, ns) in queue_families_specs.iter_mut() { + if let Some(existing_family_spec) = queue_families_specs_real + .iter() + .position(|(qf2, _): &(&QueueFamilyT, &[f32])| qf2.id() == qf.id()) + { + ns.extend(queue_families_specs_real[existing_family_spec].1.iter()); + queue_families_specs_real[existing_family_spec] = (*qf, ns.as_slice()); + } else { + queue_families_specs_real.push((*qf, ns.as_slice())) + } + } let gpu = unsafe { adapter @@ -166,7 +176,6 @@ impl RenderingContext { let queue = queue_negotiator .get_queue::<DrawQueue>() - .ok_or(EnvironmentError::NoQueues) .context("Error getting draw queue")?; Ok(RenderingContext { |