Add Queue::remove_signal_semaphore() (#9388)

This commit is contained in:
sotaroikeda authored and GitHub committed 2026-04-08 09:50:40 +02:00
1 parent 9c49f92347
commit a29a8fcf6e
2 files changed
+31

No files matched your search

+8
View File
@@ -1378,6 +1378,14 @@ impl Queue {
guard.push_signal(SemaphoreType::Binary(semaphore));
}
}
/// Remove `semaphore` from the pending signal list if it is still present.
///
/// Returns `true` if the semaphore was found and removed. If the submit
/// already consumed it, this is a harmless no-op that returns `false`.
pub fn remove_signal_semaphore(&self, semaphore: vk::Semaphore) -> bool {
self.signal_semaphores.lock().remove(semaphore)
}
}
/// Maps
+23
View File
@@ -147,6 +147,29 @@ impl SemaphoreList {
self.check();
}
/// Remove all entries matching `semaphore` from the list. Returns `true`
/// if anything was removed.
pub fn remove(&mut self, semaphore: vk::Semaphore) -> bool {
let mut removed = false;
let mut i = 0;
while i < self.semaphores.len() {
if self.semaphores[i] == semaphore {
self.semaphores.swap_remove(i);
if !self.values.is_empty() {
self.values.swap_remove(i);
}
if !self.stage_masks.is_empty() {
self.stage_masks.swap_remove(i);
}
removed = true;
} else {
i += 1;
}
}
self.check();
removed
}
/// Append `other` to `self`, leaving `other` empty.
pub fn append(&mut self, other: &mut Self) {
assert_eq!(self.mode, other.mode);