Fix submission tracking

This commit is contained in:
Dzmitry Malyshau committed 2019-03-31 19:59:21 -04:00
1 parent 006d40a4b5
commit b96983a56b
2 files changed
+17 -17

No files matched your search

+6 -1
View File
@@ -9,6 +9,7 @@ use hal::{
pool::RawCommandPool,
Device,
};
use log::trace;
use parking_lot::Mutex;
use std::{
@@ -17,6 +18,7 @@ use std::{
thread,
};
struct CommandPool<B: hal::Backend> {
raw: B::CommandPool,
available: Vec<B::CommandBuffer>,
@@ -109,7 +111,9 @@ impl<B: hal::Backend> CommandAllocator<B> {
pool.available.pop().unwrap()
}
pub fn after_submit(&self, cmd_buf: CommandBuffer<B>) {
pub fn after_submit(&self, cmd_buf: CommandBuffer<B>, submit_index: SubmissionIndex) {
cmd_buf.life_guard.submission_index
.store(submit_index, Ordering::Release);
self.inner.lock().pending.push(cmd_buf);
}
@@ -122,6 +126,7 @@ impl<B: hal::Backend> CommandAllocator<B> {
.load(Ordering::Acquire);
if index <= last_done {
let cmd_buf = inner.pending.swap_remove(i);
trace!("recycling comb submitted in {} when {} is done", index, last_done);
inner.recycle(cmd_buf);
}
}