mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 14:31:08 +01:00
Add Queue::remove_signal_semaphore() (#9388)
This commit is contained in:
1 parent
9c49f92347
commit
a29a8fcf6e
2 files changed
+31
No files matched your search
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user