fix(core): Fix lock release order in PendingSubmission and Queue::write_buffer

This commit is contained in:
Andy Leiserson committed 2026-08-14 18:59:00 -07:00
1 parent a20d5d4c9b
commit 192207d376
1 file changed
+2 -7
+2 -7
View File
@@ -635,8 +635,7 @@ impl WebGpuError for QueueSubmitError {
/// [`submit`]: `PendingSubmission::submit`
pub(crate) struct PendingSubmission<'a> {
queue: &'a Queue,
// NOTE: Guards must be declared in reverse of acquisition order, so `wgpu_validate_locks`
// succeeds.
// The lock ordering checker cares about the drop order for these guards.
command_index_guard: RwLockWriteGuard<'a, CommandIndices>,
snatch_guard: SnatchGuard<'a>,
// Command buffers to be executed, along with trackers for the resources they use.
@@ -729,12 +728,8 @@ impl Queue {
buffer_offset,
);
drop(snatch_guard);
pending_writes.consume(staging_buffer);
drop(pending_writes);
result
}
@@ -1704,8 +1699,8 @@ impl Queue {
let submission = PendingSubmission {
queue: self,
snatch_guard,
command_index_guard,
snatch_guard,
executions: Vec::new(),
surface_textures: FastHashMap::default(),
index,