Skip to content

Commit 33e8df0

Browse files
authored
Fix deadlock between snatchable_lock and trackers in Queue::write_texture (#7004)
* Fix deadlock between snatchable_lock and trackers in Queue::write_texture * Fix another deadlock in write_texture between pending_writes and snatchable_lock.
1 parent df54acc commit 33e8df0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ By @brodycj in [#6924](https://github.com/gfx-rs/wgpu/pull/6924).
7575
- Fix `wgpu` not building with `--no-default-features` on when targeting `wasm32-unknown-unknown`. By @wumpf in [#6946](https://github.com/gfx-rs/wgpu/pull/6946).
7676
- Fix `CopyExternalImageDestInfo` not exported on `wgpu`. By @wumpf in [#6962](https://github.com/gfx-rs/wgpu/pull/6962).
7777
- Fix drop order in `Surface`. By @ed-2100 in [#6997](https://github.com/gfx-rs/wgpu/pull/6997)
78+
- Fix a possible deadlock within `Queue::write_texture`. By @metamuffin in [#7004](https://github.com/gfx-rs/wgpu/pull/7004)
7879

7980
#### Vulkan
8081

wgpu-core/src/device/queue.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ impl Queue {
697697
.map_err(TransferError::from)?;
698698
}
699699

700+
let snatch_guard = self.device.snatchable_lock.read();
701+
700702
let mut pending_writes = self.pending_writes.lock();
701703
let encoder = pending_writes.activate();
702704

@@ -732,7 +734,7 @@ impl Queue {
732734
&mut trackers.textures,
733735
&self.device.alignments,
734736
self.device.zero_buffer.as_ref(),
735-
&self.device.snatchable_lock.read(),
737+
&snatch_guard,
736738
)
737739
.map_err(QueueWriteError::from)?;
738740
}
@@ -742,8 +744,6 @@ impl Queue {
742744
}
743745
}
744746

745-
let snatch_guard = self.device.snatchable_lock.read();
746-
747747
let dst_raw = dst.try_raw(&snatch_guard)?;
748748

749749
let (block_width, block_height) = dst.desc.format.block_dimensions();

0 commit comments

Comments
 (0)