mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Still close the encoder on error
This commit is contained in:
committed by
Dzmitry Malyshau
parent
bdd72dc94d
commit
83abe2a06d
@@ -348,16 +348,23 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
let mut token = Token::root();
|
||||
let (mut cmd_buf_guard, _) = hub.command_buffers.write(&mut token);
|
||||
|
||||
let error = match CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id) {
|
||||
Ok(cmd_buf) => {
|
||||
cmd_buf.encoder.close();
|
||||
cmd_buf.status = CommandEncoderStatus::Finished;
|
||||
//Note: if we want to stop tracking the swapchain texture view,
|
||||
// this is the place to do it.
|
||||
log::trace!("Command buffer {:?} {:#?}", encoder_id, cmd_buf.trackers);
|
||||
None
|
||||
}
|
||||
Err(e) => Some(e),
|
||||
let error = match cmd_buf_guard.get_mut(encoder_id) {
|
||||
Ok(cmd_buf) => match cmd_buf.status {
|
||||
CommandEncoderStatus::Recording => {
|
||||
cmd_buf.encoder.close();
|
||||
cmd_buf.status = CommandEncoderStatus::Finished;
|
||||
//Note: if we want to stop tracking the swapchain texture view,
|
||||
// this is the place to do it.
|
||||
log::trace!("Command buffer {:?} {:#?}", encoder_id, cmd_buf.trackers);
|
||||
None
|
||||
}
|
||||
CommandEncoderStatus::Finished => Some(CommandEncoderError::NotRecording),
|
||||
CommandEncoderStatus::Error => {
|
||||
cmd_buf.encoder.close();
|
||||
Some(CommandEncoderError::Invalid)
|
||||
}
|
||||
},
|
||||
Err(_) => Some(CommandEncoderError::Invalid),
|
||||
};
|
||||
|
||||
(encoder_id, error)
|
||||
|
||||
Reference in New Issue
Block a user