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.
This commit is contained in:
teoxoy 2024-11-12 20:20:09 +01:00 committed by Teodor Tanasoaia
parent 5a3de2d3a8
commit 278620be26

View File

@ -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(
@ -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(