mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
Merge #442
442: Fix cmd buffer cleanup not always using lowest active index r=kvark a=LaylConway This fixes the index picked for cleanup not always being the lowest index. Additionally this fixes command buffers not being cleaned up if there are no active submissions, because in that case 0 would be picked, which resulted in nothing being cleaned up. Now instead if there are no active submissions, usize MAX will be picked. Fixes #441 Co-authored-by: Layl <2385329-layl@users.noreply.gitlab.com>
This commit is contained in:
commit
eedc706ee7
@ -35,7 +35,7 @@ impl<B: hal::Backend> CommandPool<B> {
|
||||
if index < lowest_active_index {
|
||||
let cmd_buf = self.pending.swap_remove(i);
|
||||
log::trace!(
|
||||
"recycling comb submitted in {} when {} is done",
|
||||
"recycling comb submitted in {} when {} is lowest active",
|
||||
index,
|
||||
lowest_active_index,
|
||||
);
|
||||
|
@ -1546,11 +1546,12 @@ impl<F: IdentityFilter<CommandEncoderId>> Global<F> {
|
||||
ref_count: device.life_guard.ref_count.clone(),
|
||||
};
|
||||
|
||||
// The first entry in the active list should have the lowest index
|
||||
// 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.
|
||||
let lowest_active_index = device.pending.lock()
|
||||
.active.get(0)
|
||||
.map(|active| active.index)
|
||||
.unwrap_or(0);
|
||||
.active
|
||||
.iter()
|
||||
.fold(std::usize::MAX, |v, active| active.index.min(v));
|
||||
|
||||
let mut comb = device
|
||||
.com_allocator
|
||||
|
Loading…
Reference in New Issue
Block a user