Skip to content

Commit

Permalink
wgpu-core: Register new pipelines with device's tracker.
Browse files Browse the repository at this point in the history
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 gfx-rs#2564.
  • Loading branch information
jimblandy authored and kvark committed Apr 1, 2022
1 parent 85e5c36 commit 84fadca
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down Expand Up @@ -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);
};

Expand Down

0 comments on commit 84fadca

Please sign in to comment.