mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
Change the order to suspect temporary resources earlier
This commit is contained in:
parent
63019893df
commit
80ab18404e
@ -223,7 +223,6 @@ impl<A: hal::Api> LifetimeTracker<A> {
|
||||
pub fn track_submission(
|
||||
&mut self,
|
||||
index: SubmissionIndex,
|
||||
new_suspects: &SuspectedResources,
|
||||
temp_resources: impl Iterator<Item = TempResource<A>>,
|
||||
encoders: Vec<EncoderInFlight<A>>,
|
||||
) {
|
||||
@ -245,7 +244,6 @@ impl<A: hal::Api> LifetimeTracker<A> {
|
||||
.drain(..)
|
||||
.map(|stored| stored.value),
|
||||
);
|
||||
self.suspected_resources.extend(new_suspects);
|
||||
|
||||
self.active.alloc().init(ActiveSubmission {
|
||||
index,
|
||||
@ -314,12 +312,15 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
pub(super) fn triage_suspected<G: GlobalIdentityHandlerFactory>(
|
||||
&mut self,
|
||||
hub: &Hub<A, G>,
|
||||
new_suspects: &SuspectedResources,
|
||||
trackers: &Mutex<TrackerSet>,
|
||||
#[cfg(feature = "trace")] trace: Option<&Mutex<trace::Trace>>,
|
||||
token: &mut Token<super::Device<A>>,
|
||||
) {
|
||||
profiling::scope!("triage_suspected");
|
||||
|
||||
self.suspected_resources.extend(new_suspects);
|
||||
|
||||
if !self.suspected_resources.render_bundles.is_empty() {
|
||||
let (mut guard, _) = hub.render_bundles.write(token);
|
||||
let mut trackers = trackers.lock();
|
||||
|
@ -360,6 +360,7 @@ impl<A: HalApi> Device<A> {
|
||||
|
||||
life_tracker.triage_suspected(
|
||||
hub,
|
||||
&self.temp_suspected,
|
||||
&self.trackers,
|
||||
#[cfg(feature = "trace")]
|
||||
self.trace.as_ref(),
|
||||
@ -4159,6 +4160,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
let device = device_guard.get(device_id).map_err(|_| InvalidDevice)?;
|
||||
device.lock_life(&mut token).triage_suspected(
|
||||
&hub,
|
||||
&device.temp_suspected,
|
||||
&device.trackers,
|
||||
#[cfg(feature = "trace")]
|
||||
None,
|
||||
|
@ -805,7 +805,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
}
|
||||
super::Device::lock_life_internal(&device.life_tracker, &mut token).track_submission(
|
||||
submit_index,
|
||||
&device.temp_suspected,
|
||||
device.pending_writes.temp_resources.drain(..),
|
||||
active_executions,
|
||||
);
|
||||
|
@ -277,13 +277,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
let view = &mut view_guard[view_id.value];
|
||||
let _ = view.life_guard.ref_count.take();
|
||||
|
||||
/*
|
||||
let (view_maybe, _) = hub.texture_views.unregister(view_id.value.0, &mut token);
|
||||
drop(view_id); // contains the ref count
|
||||
let view = view_maybe.ok_or(SwapChainError::Invalid)?;
|
||||
if view.life_guard.ref_count.unwrap().load() != 1 {
|
||||
return Err(SwapChainError::StillReferenced);
|
||||
}*/
|
||||
suf_texture
|
||||
};
|
||||
|
||||
|
@ -250,7 +250,7 @@ impl<S: ResourceState> ResourceTracker<S> {
|
||||
Entry::Occupied(e) => {
|
||||
if e.get().ref_count.load() == 1 {
|
||||
let res = e.remove();
|
||||
assert_eq!(res.epoch, epoch);
|
||||
assert_eq!(res.epoch, epoch, "Epoch mismatch for {:?}", id);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
Loading…
Reference in New Issue
Block a user