From 84fadca8700723cfba2416596168daec78932336 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 30 Mar 2022 22:35:08 -0700 Subject: [PATCH] wgpu-core: Register new pipelines with device's tracker. Without this change, `LifetimeTracker::triage_suspected` never notices that compute or render pipelines are free, and they stick around until the hub is destroyed. Fixes #2564. --- wgpu-core/src/device/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index e09329f6b3..62fa2386c4 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -4520,8 +4520,17 @@ impl Global { Ok(pair) => pair, Err(e) => break e, }; + let ref_count = pipeline.life_guard.add_ref(); let id = fid.assign(pipeline, &mut token); + log::info!("Created render pipeline {:?} with {:?}", id, desc); + + device + .trackers + .lock() + .render_pipes + .init(id, ref_count, PhantomData) + .unwrap(); return (id.0, None); }; @@ -4652,8 +4661,17 @@ impl Global { Ok(pair) => pair, Err(e) => break e, }; + let ref_count = pipeline.life_guard.add_ref(); let id = fid.assign(pipeline, &mut token); + log::info!("Created compute pipeline {:?} with {:?}", id, desc); + + device + .trackers + .lock() + .compute_pipes + .init(id, ref_count, PhantomData) + .unwrap(); return (id.0, None); };