Skip to content

Commit

Permalink
[vulkan] Don't free command buffers before destroying the pool.
Browse files Browse the repository at this point in the history
Calling `vkDestroyCommandPool` automatically frees all command buffers allocated
from that pool, so there is no need for `Device::destroy_command_encoder` to
explicitly call `vkFreeCommandBuffers` on the `CommandEncoder`'s `free` and
`discarded` lists.
  • Loading branch information
jimblandy committed Aug 15, 2023
1 parent 09b010b commit deeecc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Bottom level categories:

- Omit texture store bound checks since they are no-ops if out of bounds on all APIs. By @teoxoy in [#3975](https://github.com/gfx-rs/wgpu/pull/3975)

#### Vulkan

- Don't bother calling `vkFreeCommandBuffers` when `vkDestroyCommandPool` will take care of that for us. By @jimblandy in [#4059](https://github.com/gfx-rs/wgpu/pull/4059)

### Bug Fixes

#### General
Expand Down
10 changes: 0 additions & 10 deletions wgpu-hal/src/vulkan/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,16 +1192,6 @@ impl crate::Device<super::Api> for super::Device {
}
unsafe fn destroy_command_encoder(&self, cmd_encoder: super::CommandEncoder) {
unsafe {
if !cmd_encoder.free.is_empty() {
self.shared
.raw
.free_command_buffers(cmd_encoder.raw, &cmd_encoder.free)
}
if !cmd_encoder.discarded.is_empty() {
self.shared
.raw
.free_command_buffers(cmd_encoder.raw, &cmd_encoder.discarded)
}
self.shared.raw.destroy_command_pool(cmd_encoder.raw, None);
}
}
Expand Down

0 comments on commit deeecc7

Please sign in to comment.