Skip to content

Commit 278620b

Browse files
committed
destroy subsequent command buffers if we encountered an error at submission
This gets the `wgpu_test::ray_tracing::as_build::out_of_order_as_build` test to pass. This seems to be an issue even on trunk, looking at the nr of calls to `create_command_encoder` & `destroy_command_encoder` in hal, they are not equal. So, I'm not sure why the validation layers don't raise the `VUID-vkDestroyDevice-device-05137`. There is still an issue with previous command buffers being leaked but I will fix this in a follow-up.
1 parent 5a3de2d commit 278620b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

wgpu-core/src/device/queue.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,13 @@ impl Queue {
12091209
}
12101210
}
12111211

1212+
if first_error.is_some() {
1213+
if let Ok(cmd_buf_data) = cmd_buf_data {
1214+
cmd_buf_data.destroy(&command_buffer.device);
1215+
}
1216+
continue;
1217+
}
1218+
12121219
let mut baked = match cmd_buf_data {
12131220
Ok(cmd_buf_data) => {
12141221
let res = validate_command_buffer(
@@ -1232,10 +1239,6 @@ impl Queue {
12321239
}
12331240
};
12341241

1235-
if first_error.is_some() {
1236-
continue;
1237-
}
1238-
12391242
// execute resource transitions
12401243
if let Err(e) = unsafe {
12411244
baked.encoder.begin_encoding(hal_label(

0 commit comments

Comments
 (0)