Skip to content

Make ImGui binds the fallback texture descriptor set when the recorded draw command ImTextureID is destroyed by ImGui_ImplVulkan_RemoveTexture. #70

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

Merged
merged 3 commits into from
Apr 7, 2025

Conversation

stripe2933
Copy link
Owner

This PR tweaks the ImGui's internal Vulkan backend by tracking the allocated/destroyed descriptor sets using std::unordered_set<VkDescriptorSet>, and checking their validity when executing ImGui_ImplVulkan_RenderDrawData(). This can simplify the ImGui texture descriptor set lifetime management by:

  • asset ImGui texture descriptor set lifetime doesn't have to be retained using std::vector::resize() trick,
  • therefore it can be inside the belonging structure SharedData::GltfAsset and can be managed by RAII allocation/destroying (and so do the skybox descriptor set).

To ensure the allocated ImGui texture descriptor set is destroyed before ImGui_ImplVulkan_Shutdown() call, ImGui context creation/destroying is reimplemented by RAII structure ImGuiContext in MainApp.

…d draw command ImTextureID is destroyed by ImGui_ImplVulkan_RemoveTexture.

It tracks the allocated/destroyed descriptor sets using std::unordered_set<VkDescriptorSet> and check their validity when executing ImGui_ImplVulkan_RenderDrawData().
It simplifies the asset ImGui texture descriptor set lifetime management (lifetime doesn't have to be retained using std::vector::resize() trick).
@stripe2933 stripe2933 merged commit b4cedac into master Apr 7, 2025
5 checks passed
@stripe2933 stripe2933 deleted the imgui-descriptor-set branch April 7, 2025 17:47
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.

1 participant