aboutsummaryrefslogtreecommitdiff
path: root/stockton-skeleton/src/queue_negotiator.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:24 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:24 +0100
commit4f068467c4954fb79e6ce297ae1ac0fdd2bdf16a (patch)
tree4b3ec44d068f71ab80e8c85a6515a8862407ac56 /stockton-skeleton/src/queue_negotiator.rs
parent5e6396ed225be9a9991705de10174b3cf085f8f0 (diff)
WIP refactor(skeleton): type state for context
also some api improvements closes #2 related: #7
Diffstat (limited to 'stockton-skeleton/src/queue_negotiator.rs')
-rw-r--r--stockton-skeleton/src/queue_negotiator.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/stockton-skeleton/src/queue_negotiator.rs b/stockton-skeleton/src/queue_negotiator.rs
index b78fe33..765516b 100644
--- a/stockton-skeleton/src/queue_negotiator.rs
+++ b/stockton-skeleton/src/queue_negotiator.rs
@@ -70,7 +70,7 @@ impl QueueFamilyNegotiator {
mut count: usize,
) -> Result<()> {
if let Entry::Occupied(e) = self.family_ids.entry(TypeId::of::<T>()) {
- count = count + e.get().0;
+ count += e.get().0;
}
let candidates: Vec<&QueueFamilyT> = adapter
@@ -123,7 +123,7 @@ impl QueueFamilyNegotiator {
}
/// Finish selecting our queue families, and turn this into a `QueueNegotiator`
- pub fn finish<'a>(self, queue_groups: Vec<QueueGroup>) -> QueueNegotiator {
+ pub fn finish(self, queue_groups: Vec<QueueGroup>) -> QueueNegotiator {
QueueNegotiator {
family_ids: self.family_ids,
already_allocated: HashMap::new(),
@@ -132,6 +132,12 @@ impl QueueFamilyNegotiator {
}
}
+impl Default for QueueFamilyNegotiator {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
/// Used internally in calls to [`hal::adapter::PhysicalDevice::open`]
pub(crate) struct AdapterOpenSpec<'a>(Box<[(&'a QueueFamilyT, Vec<f32>)]>);
@@ -164,7 +170,7 @@ impl QueueNegotiator {
/// You should already have called [`self::QueueFamilyNegotiator::find`], otherwise this will return an error.
///
/// The family of the queue returned is guaranteed to meet the spec of the `QueueFamilySelector` originally used by `find`.
- pub fn get_queue<T: QueueFamilySelector>(&mut self) -> Result<Arc<RwLock<QueueT>>> {
+ pub fn get_queue<T: QueueFamilySelector>(&mut self) -> Result<SharedQueue> {
let tid = TypeId::of::<T>();
let (_, family_id) = self
.family_ids