mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
don't check if the buffer is still "present" from the user's perspective in LifetimeTracker.handle_mapping
This change doesn't change behavior as `Global.buffer_drop` already unmaps the buffer.
This commit is contained in:
parent
3cc6c2743a
commit
3fba403060
@ -710,7 +710,6 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
pub(crate) fn handle_mapping(
|
||||
&mut self,
|
||||
raw: &A::Device,
|
||||
trackers: &Mutex<Tracker<A>>,
|
||||
snatch_guard: &SnatchGuard,
|
||||
) -> Vec<super::BufferMapPendingClosure> {
|
||||
if self.ready_to_map.is_empty() {
|
||||
@ -721,14 +720,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for buffer in self.ready_to_map.drain(..) {
|
||||
let tracker_index = buffer.tracker_index();
|
||||
let is_removed = {
|
||||
let mut trackers = trackers.lock();
|
||||
trackers.buffers.remove_abandoned(tracker_index)
|
||||
};
|
||||
if is_removed {
|
||||
*buffer.map_state.lock() = resource::BufferMapState::Idle;
|
||||
log::trace!("Buffer ready to map {tracker_index:?} is not tracked anymore");
|
||||
} else {
|
||||
|
||||
// This _cannot_ be inlined into the match. If it is, the lock will be held
|
||||
// open through the whole match, resulting in a deadlock when we try to re-lock
|
||||
// the buffer back to active.
|
||||
@ -763,8 +755,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
Ok(ptr) => {
|
||||
*buffer.map_state.lock() = resource::BufferMapState::Active {
|
||||
ptr,
|
||||
range: pending_mapping.range.start
|
||||
..pending_mapping.range.start + size,
|
||||
range: pending_mapping.range.start..pending_mapping.range.start + size,
|
||||
host,
|
||||
};
|
||||
Ok(())
|
||||
@ -784,7 +775,6 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
};
|
||||
pending_callbacks.push((pending_mapping.op, status));
|
||||
}
|
||||
}
|
||||
pending_callbacks
|
||||
}
|
||||
}
|
||||
|
@ -430,8 +430,7 @@ impl<A: HalApi> Device<A> {
|
||||
|
||||
life_tracker.triage_mapped();
|
||||
|
||||
let mapping_closures =
|
||||
life_tracker.handle_mapping(self.raw(), &self.trackers, &snatch_guard);
|
||||
let mapping_closures = life_tracker.handle_mapping(self.raw(), &snatch_guard);
|
||||
|
||||
let queue_empty = life_tracker.queue_empty();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user