Added optional push-descriptor path allowing direct VkImageView usage as ImTextureID.#9402
Open
Seokwon-Park wants to merge 2 commits into
Open
Added optional push-descriptor path allowing direct VkImageView usage as ImTextureID.#9402Seokwon-Park wants to merge 2 commits into
Seokwon-Park wants to merge 2 commits into
Conversation
…g VkImageView as ImTextureID.
Author
|
An optional Vulkan backend path that allows users to directly pass a VkImageView as ImTextureID by utilizing Push Descriptors, bringing Vulkan texture usage closer to the behavior of other Dear ImGui rendering backends Based on and targeted for the Changes and features:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the Vulkan backend differs from other Dear ImGui rendering backends in how user textures are submitted.
If a user wants to render a custom engine texture in the UI:
GLuintcast toImTextureID).ID3D11ShaderResourceView*asImTextureID.D3D12_GPU_DESCRIPTOR_HANDLEasImTextureID.ImGui_ImplVulkan_AddTexture()to bake theVkImageViewinto a Descriptor Set allocated from a pool.To resolve this inconsistency, I implemented a way to use
VkImageViewdirectly as anImTextureID, just like other APIs do. I utilizedVK_KHR_push_descriptor(promoted to core in Vulkan 1.4) to streamline this process.How it works:
Set 1holds theVkSampler(ImGui's font sampler), andSet 0is reserved for pushedVkImageView(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE).ImGui_ImplVulkan_RenderDrawData, usevkCmdPushDescriptorSetKHRto bind the texture directly frompcmd->GetTexID().Before:
VkDescriptorSet uiSet = ImGui_ImplVulkan_AddTexture(sampler, myImageView, layout); ImGui::Image((ImTextureID)uiSet, size);After: