From 4617da2818eb3ecc17b1da9571b7baa15056c026 Mon Sep 17 00:00:00 2001 From: Malte Veerman Date: Sun, 19 Jan 2020 18:06:46 +0100 Subject: Implemented automatic deallocation of texture space for dropped allocations --- wgpu/src/image/raster.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'wgpu/src/image/raster.rs') diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs index 648df0ff..884dd65a 100644 --- a/wgpu/src/image/raster.rs +++ b/wgpu/src/image/raster.rs @@ -91,17 +91,9 @@ impl Cache { memory } - pub fn trim(&mut self, texture_array: &mut TextureArray) { + pub fn trim(&mut self) { let hits = &self.hits; - for (id, mem) in &self.map { - if let Memory::Device(allocation) = mem { - if !hits.contains(&id) { - texture_array.deallocate(allocation); - } - } - } - self.map.retain(|k, _| hits.contains(k)); self.hits.clear(); } -- cgit