From deeecc7f73efb93e49f4f871faf27d293aaaac77 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 15 Aug 2023 14:53:25 -0700 Subject: [PATCH] [vulkan] Don't free command buffers before destroying the pool. 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. --- CHANGELOG.md | 4 ++++ wgpu-hal/src/vulkan/device.rs | 10 ---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72aa2022c22..54bc33d58b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 43410be885e..268dbbf72f5 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -1192,16 +1192,6 @@ impl crate::Device 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); } }