mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
Merge #1505
1505: Change the order to suspect temporary resources earlier r=kvark a=kvark **Connections** Fixes #1504 **Description** I don't fully understand why this works. **Testing** tested on the privately given case, also our examples Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
commit
ca291bfc4f
@ -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