Skip to content

Commit f9f55b7

Browse files
fix(core): drop PendingSubmission's guards in reverse acquisition order (#9960)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
1 parent ecf8932 commit f9f55b7

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Bottom level categories:
8080

8181
- Zero-initialize padding (if any) at the end of a buffer allocation. This was application-visible in rare cases on Vulkan when a shader read beyond the valid range of a vertex buffer. By @andyleiserson in [#9791](https://github.com/gfx-rs/wgpu/pull/9791).
8282
- Fix required immediate slots calculation and remove `naga::valid::FunctionInfo::immediate_slots_used`. By @beicause in [#9725](https://github.com/gfx-rs/wgpu/pull/9725).
83+
- Fix `PendingSubmission` releasing its lock guards out of stacking order, which tripped `--cfg wgpu_validate_locks` on any submission. By @AdrianEddy in [#9960](https://github.com/gfx-rs/wgpu/pull/9960).
8384

8485
#### naga
8586

wgpu-core/src/device/queue.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,10 @@ impl WebGpuError for QueueSubmitError {
638638
/// [`submit`]: `PendingSubmission::submit`
639639
pub(crate) struct PendingSubmission<'a> {
640640
queue: &'a Queue,
641-
snatch_guard: SnatchGuard<'a>,
641+
// NOTE: Guards must be declared in reverse of acquisition order, so `wgpu_validate_locks`
642+
// succeeds.
642643
command_index_guard: RwLockWriteGuard<'a, CommandIndices>,
644+
snatch_guard: SnatchGuard<'a>,
643645
// Command buffers to be executed, along with trackers for the resources they use.
644646
pub executions: Vec<EncoderInFlight>,
645647
// Surface textures referenced by command buffers in this submission. These need to be

0 commit comments

Comments
 (0)