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.
This commit is contained in:
Jim Blandy
2022-03-30 22:35:08 -07:00
committed by Dzmitry Malyshau
parent 85e5c36b68
commit 84fadca870

View File

@@ -4520,8 +4520,17 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
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<G: GlobalIdentityHandlerFactory> Global<G> {
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);
};