diff --git a/Cargo.lock b/Cargo.lock index 2cc4eda88a..fd595b66cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -473,7 +473,6 @@ dependencies = [ "raw-window-handle", "smallvec", "winapi 0.3.8", - "x11", ] [[package]] @@ -1510,16 +1509,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "x11" -version = "2.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "x11-dl" version = "2.18.5" diff --git a/wgpu-core/src/command/allocator.rs b/wgpu-core/src/command/allocator.rs index 4a882b91d1..1a2ce77adb 100644 --- a/wgpu-core/src/command/allocator.rs +++ b/wgpu-core/src/command/allocator.rs @@ -24,14 +24,14 @@ struct CommandPool { } impl CommandPool { - fn maintain(&mut self, lowest_active_index: SubmissionIndex) { + fn maintain(&mut self, last_done_index: SubmissionIndex) { for i in (0..self.pending.len()).rev() { - if self.pending[i].1 < lowest_active_index { + if self.pending[i].1 <= last_done_index { let (cmd_buf, index) = self.pending.swap_remove(i); log::trace!( - "recycling comb submitted in {} when {} is lowest active", + "recycling comb submitted in {} when {} is last done", index, - lowest_active_index, + last_done_index, ); self.recycle(cmd_buf); } @@ -185,7 +185,7 @@ impl CommandAllocator { let mut inner = self.inner.lock(); inner .pools - .get_mut(&thread::current().id()) + .get_mut(&self.internal_thread_id) .unwrap() .pending .push((raw, submit_index)); @@ -202,11 +202,11 @@ impl CommandAllocator { .extend(cmd_buf.raw.into_iter().map(|raw| (raw, submit_index))); } - pub fn maintain(&self, device: &B::Device, lowest_active_index: SubmissionIndex) { + pub fn maintain(&self, device: &B::Device, last_done_index: SubmissionIndex) { let mut inner = self.inner.lock(); let mut remove_threads = Vec::new(); for (thread_id, pool) in inner.pools.iter_mut() { - pool.maintain(lowest_active_index); + pool.maintain(last_done_index); if pool.total == pool.available.len() { assert!(pool.pending.is_empty()); remove_threads.push(*thread_id); diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index 25fdf9299a..4b92d849d2 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -234,6 +234,7 @@ impl LifetimeTracker { /// Find the pending entry with the lowest active index. If none can be found that means /// everything in the allocator can be cleaned up, so std::usize::MAX is correct. + #[cfg(feature = "replay")] pub fn lowest_active_submission(&self) -> SubmissionIndex { self.active .iter() diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 2fd0a58021..0f8148645d 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -312,12 +312,11 @@ impl Device { ); life_tracker.triage_mapped(global, token); life_tracker.triage_framebuffers(global, &mut *self.framebuffers.lock(), token); - let _last_done = life_tracker.triage_submissions(&self.raw, force_wait); + let last_done = life_tracker.triage_submissions(&self.raw, force_wait); let callbacks = life_tracker.handle_mapping(global, &self.raw, &self.trackers, token); life_tracker.cleanup(&self.raw, &self.mem_allocator, &self.desc_allocator); - self.com_allocator - .maintain(&self.raw, life_tracker.lowest_active_submission()); + self.com_allocator.maintain(&self.raw, last_done); callbacks }