Skip to content

Conversation

shawnhatori
Copy link
Contributor

@shawnhatori shawnhatori commented Feb 12, 2024

RemoveTexture() tries to free a descriptor set on shutdown, which requires the caller to provide a descriptor pool with VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT set. If the pool does not have this set, it is a validation error. I don't think this is a restriction the backend should impose. Since it's the caller's responsibility to provide the pool, it should be the caller's responsibility to free the pool on shutdown (which frees the descriptor sets therein).

The easiest way to integrate with this Vulkan backend is to take your existing descriptor pool (used for whatever else in your application), accommodate the necessary space for what ImGui needs, and provide that. Removing the requirement for the aforementioned bitmask flag allows you to do so without having to change the characteristics of your pool.

@shawnhatori
Copy link
Contributor Author

shawnhatori commented Feb 12, 2024

For reference, the mentioned validation error is listed in the documentation here:
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkFreeDescriptorSets.html#VUID-vkFreeDescriptorSets-descriptorPool-00312

@shawnhatori shawnhatori changed the title Vulkan backend: remove call to RemoveTexture(), correct comment Vulkan backend: remove call to RemoveTexture() Feb 12, 2024
@ocornut
Copy link
Owner

ocornut commented Jan 10, 2025

Hello Shawn,
Sorry for my late answer.

The easiest way to integrate with this Vulkan backend is to take your existing descriptor pool (used for whatever else in your application), accommodate the necessary space for what ImGui needs, and provide that. Removing the requirement for the aforementioned bitmask flag allows you to do so without having to change the characteristics of your pool.

Going onward we will absolutely require the VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT as textures are going to be (occasionally) created/removed during runtime when a resize is needed. I'm working on the new font atlas system right now.

Note that 61ab94d about 40 days ago added an option to let the backend automatically create the pool, by setting init_info->DescriptorPoolSize = IMGUI_IMPL_VULKAN_MINIMUM_IMAGE_SAMPLER_POOL_SIZE.

For both reasons I don't think we need to merge this anymore.
Please let me know if you think otherwise!

@ocornut ocornut closed this Jan 10, 2025
@shawnhatori
Copy link
Contributor Author

Hey @ocornut, thanks for following up! Yes, I agree this is no longer needed. My workaround was just to create a dedicated pool for ImGui, in which case I felt that the API should make it clear to do that, or even better create it for you. That's exactly what Arseny's change does - great! :)

@shawnhatori shawnhatori deleted the vk-texture-dp branch January 12, 2025 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants