Skip to content

Commit 18b7904

Browse files
fix: discard cmd. enc. buf. on wgpu_core::Global::command_encoder_drop
1 parent 754d93a commit 18b7904

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Bottom level categories:
113113
- Fix panic when creating a surface while no backend is available. By @wumpf [#5166](https://github.com/gfx-rs/wgpu/pull/5166)
114114
- Correctly compute minimum buffer size for array-typed `storage` and `uniform` vars. By @jimblandy [#5222](https://github.com/gfx-rs/wgpu/pull/5222)
115115
- Fix timeout when presenting a surface where no work has been done. By @waywardmonkeys in [#5200](https://github.com/gfx-rs/wgpu/pull/5200)
116+
- 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).
116117

117118
#### WGL
118119

wgpu-core/src/command/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<A: HalApi> CommandEncoder<A> {
7575
Ok(())
7676
}
7777

78-
fn discard(&mut self) {
78+
pub(crate) fn discard(&mut self) {
7979
if self.is_open {
8080
self.is_open = false;
8181
unsafe { self.raw.discard_encoding() };
@@ -112,7 +112,7 @@ pub(crate) struct DestroyedBufferError(pub id::BufferId);
112112
pub(crate) struct DestroyedTextureError(pub id::TextureId);
113113

114114
pub struct CommandBufferMutable<A: HalApi> {
115-
encoder: CommandEncoder<A>,
115+
pub(crate) encoder: CommandEncoder<A>,
116116
status: CommandEncoderStatus,
117117
pub(crate) trackers: Tracker<A>,
118118
buffer_memory_init_actions: Vec<BufferInitTrackerAction<A>>,

wgpu-core/src/device/global.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,7 @@ impl Global {
13771377
.command_buffers
13781378
.unregister(command_encoder_id.transmute())
13791379
{
1380+
cmd_buf.data.lock().as_mut().unwrap().encoder.discard();
13801381
cmd_buf
13811382
.device
13821383
.untrack(&cmd_buf.data.lock().as_ref().unwrap().trackers);

0 commit comments

Comments
 (0)