Skip to content

Commit

Permalink
destroy subsequent command buffers if we encountered an error at subm…
Browse files Browse the repository at this point in the history
…ission

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.
  • Loading branch information
teoxoy committed Nov 14, 2024
1 parent 5a3de2d commit 278620b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,13 @@ impl Queue {
}
}

if first_error.is_some() {
if let Ok(cmd_buf_data) = cmd_buf_data {
cmd_buf_data.destroy(&command_buffer.device);
}
continue;
}

let mut baked = match cmd_buf_data {
Ok(cmd_buf_data) => {
let res = validate_command_buffer(
Expand All @@ -1232,10 +1239,6 @@ impl Queue {
}
};

if first_error.is_some() {
continue;
}

// execute resource transitions
if let Err(e) = unsafe {
baked.encoder.begin_encoding(hal_label(
Expand Down

0 comments on commit 278620b

Please sign in to comment.