Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vulkan] Don't bother to free command buffers before destroying the pool. #4059

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Aug 15, 2023

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.

Checklist

  • Run cargo clippy.
  • Run cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@jimblandy jimblandy force-pushed the vk-destroy-command-pool-is-enough branch from a3071ae to deeecc7 Compare August 15, 2023 22:00
@jimblandy
Copy link
Member Author

Please check my understanding of Vulkan, but the spec does say:

vkDestroyCommandPool
...
When a pool is destroyed, all command buffers allocated from the pool are freed.

@jimblandy jimblandy changed the title [vulkan] Don't free command buffers before destroying the pool. [vulkan] Don't bother to free command buffers before destroying the pool. Aug 16, 2023
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.
@jimblandy jimblandy force-pushed the vk-destroy-command-pool-is-enough branch from deeecc7 to f1ca502 Compare August 16, 2023 01:02
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@teoxoy teoxoy merged commit e11526e into gfx-rs:trunk Aug 16, 2023
20 checks passed
@jimblandy jimblandy deleted the vk-destroy-command-pool-is-enough branch December 13, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants