From 59fe141efd8b385591c4988c773f286b8b8adceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Tue, 28 Oct 2025 21:47:14 +0100 Subject: [PATCH] Add `debug` log to image cache eviction --- wgpu/src/image/raster.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs index 5c4ad3be..881e75e3 100644 --- a/wgpu/src/image/raster.rs +++ b/wgpu/src/image/raster.rs @@ -87,7 +87,7 @@ impl Cache { let hits = &self.hits; - self.map.retain(|k, memory| { + self.map.retain(|id, memory| { // Retain active allocations if let Memory::Device { allocation, .. } = memory && allocation @@ -97,17 +97,20 @@ impl Cache { return true; } - let retain = hits.contains(k); + let retain = hits.contains(id); - if !retain - && let Memory::Device { + if !retain { + log::debug!("Dropping image allocation: {id:?}"); + + if let Memory::Device { entry, bind_group, .. } = memory - { - if let Some(bind_group) = bind_group.take() { - on_drop(bind_group); - } else { - atlas.remove(entry); + { + if let Some(bind_group) = bind_group.take() { + on_drop(bind_group); + } else { + atlas.remove(entry); + } } }