fix: discard cmd. enc. buf. on wgpu_core::Global::command_encoder_drop

This commit is contained in:
Erich Gubler 2024-02-14 14:14:35 -05:00 committed by Connor Fitzgerald
parent be8c7e6ced
commit d189cf27e8
No known key found for this signature in database
GPG Key ID: CF0A1F83B4E1A995
3 changed files with 12 additions and 2 deletions

View File

@ -61,6 +61,14 @@ Bottom level categories:
- `tan`
- `tanh`
## v0.19.3 (2024-03-01)
### Bug Fixes
#### General
- Fix an issue where command encoders weren't properly freed if an error occurred during command encoding. By @ErichDonGubler in [#5251](https://github.com/gfx-rs/wgpu/pull/5251).
## v0.19.2 (2024-02-29)
### Added/New Features

View File

@ -78,7 +78,7 @@ impl<A: HalApi> CommandEncoder<A> {
Ok(())
}
fn discard(&mut self) {
pub(crate) fn discard(&mut self) {
if self.is_open {
self.is_open = false;
unsafe { self.raw.discard_encoding() };
@ -115,7 +115,7 @@ pub(crate) struct DestroyedBufferError(pub id::BufferId);
pub(crate) struct DestroyedTextureError(pub id::TextureId);
pub struct CommandBufferMutable<A: HalApi> {
encoder: CommandEncoder<A>,
pub(crate) encoder: CommandEncoder<A>,
status: CommandEncoderStatus,
pub(crate) trackers: Tracker<A>,
buffer_memory_init_actions: Vec<BufferInitTrackerAction<A>>,

View File

@ -1354,6 +1354,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let hub = A::hub(self);
if let Some(cmd_buf) = hub.command_buffers.unregister(command_encoder_id) {
cmd_buf.data.lock().as_mut().unwrap().encoder.discard();
cmd_buf
.device
.untrack(&cmd_buf.data.lock().as_ref().unwrap().trackers);