Skip to content

Commit

Permalink
fix: discard cmd. enc. buf. on wgpu_core::Global::command_encoder_drop
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler authored and cwfitzgerald committed Mar 1, 2024
1 parent be8c7e6 commit d189cf2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions wgpu-core/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() };
Expand Down Expand Up @@ -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>>,
Expand Down
2 changes: 2 additions & 0 deletions wgpu-core/src/device/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d189cf2

Please sign in to comment.