From 1ff70329f17da4b50c421704bdedf79088acdd1a Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 15 Nov 2021 15:58:47 -0500 Subject: [PATCH] Refactor texture view non-referenced resources (#2184) --- wgpu-core/src/device/life.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index c4b36f9745..a12e202c0e 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -86,9 +86,7 @@ impl SuspectedResources { struct NonReferencedResources { buffers: Vec, textures: Vec, - // Note: we keep the associated ID here in order to be able to check - // at any point what resources are used in a submission. - texture_views: Vec<(id::Valid, A::TextureView)>, + texture_views: Vec, samplers: Vec, bind_groups: Vec, compute_pipes: Vec, @@ -142,7 +140,7 @@ impl NonReferencedResources { } if !self.texture_views.is_empty() { profiling::scope!("destroy_texture_views"); - for (_, raw) in self.texture_views.drain(..) { + for raw in self.texture_views.drain(..) { device.destroy_texture_view(raw); } } @@ -433,7 +431,7 @@ impl LifetimeTracker { .find(|a| a.index == submit_index) .map_or(&mut self.free_resources, |a| &mut a.last_resources) .texture_views - .push((id, res.raw)); + .push(res.raw); } } }