From c0c2cdf31c09a87f187aca2044c10540ac0b4a23 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 28 May 2019 13:53:56 -0400 Subject: [PATCH] Clear command buffer tracker --- wgpu-native/src/command/allocator.rs | 3 ++- wgpu-native/src/track.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wgpu-native/src/command/allocator.rs b/wgpu-native/src/command/allocator.rs index 48b52a712..c114392f9 100644 --- a/wgpu-native/src/command/allocator.rs +++ b/wgpu-native/src/command/allocator.rs @@ -99,7 +99,8 @@ impl CommandAllocator { pool.available.pop().unwrap() } - pub fn after_submit(&self, cmd_buf: CommandBuffer, submit_index: SubmissionIndex) { + pub fn after_submit(&self, mut cmd_buf: CommandBuffer, submit_index: SubmissionIndex) { + cmd_buf.trackers.clear(); cmd_buf .life_guard .submission_index diff --git a/wgpu-native/src/track.rs b/wgpu-native/src/track.rs index 3374e9ee7..cca3742c2 100644 --- a/wgpu-native/src/track.rs +++ b/wgpu-native/src/track.rs @@ -128,6 +128,12 @@ impl TrackerSet { } } + pub fn clear(&mut self) { + self.buffers.clear(); + self.textures.clear(); + self.views.clear(); + } + pub fn consume_by_extend(&mut self, other: &Self) { self.buffers.consume_by_extend(&other.buffers).unwrap(); self.textures.consume_by_extend(&other.textures).unwrap(); @@ -280,6 +286,10 @@ impl + PartialEq> Tracker } impl + PartialEq> Tracker { + fn clear(&mut self) { + self.map.clear(); + } + fn _get_with_usage<'a, T: 'a + Borrow>( &mut self, storage: &'a Storage,