Skip to content

Backends: Vulkan: Add VK_EXT_descriptor_heap support - #9506

Open
janagor wants to merge 11 commits into
ocornut:masterfrom
janagor:VK_EXT_descriptor_heap
Open

Backends: Vulkan: Add VK_EXT_descriptor_heap support#9506
janagor wants to merge 11 commits into
ocornut:masterfrom
janagor:VK_EXT_descriptor_heap

Conversation

@janagor

@janagor janagor commented Aug 6, 2026

Copy link
Copy Markdown

This pull request resolves #9374 - it adds support for VK_EXT_descriptor_heap, based on #9437, with example usage moved from the win32_vulkan to glfw_vulkan.

Because of this note in the feature descriptions, mixing descriptor heaps with other binding models in the same command buffer is undefined. That leaves two options: (1) switch binding modes between heap and non-heap draws, or (2) use app-provided callbacks for heap slots. As noted in #9437, (1) would be too slow due to frequent backend switching, so this PR uses (2), similar to DX12's SrvDescriptorAllocFn / SrvDescriptorFreeFn.

In heap mode, ImTextureID is a non-zero heap index (index 0 is reserved because ImTextureID_Invalid is 0). Pool-path AddTexture / RemoveTexture are unavailable; the application instead sets Register* / UnRegister* callbacks on ImGui_ImplVulkan_InitInfo::DescriptorHeapInfo. Support is gated on IMGUI_IMPL_VULKAN_HAS_DESCRIPTOR_HEAP (Vulkan headers that define VK_EXT_descriptor_heap).

Using the descriptor heap requires enabling VK_EXT_descriptor_heap, VK_KHR_maintenance5, VK_KHR_buffer_device_address (or Vulkan 1.2+), and VK_KHR_shader_untyped_pointers for ImGui's default heap shaders.

examples/example_glfw_vulkan enables the heap when available. There is --require-descriptor-heap flag added to require it (or exit on failure).

@ocornut

ocornut commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Please rebase this over master to reduce the number of noise commits, if you can (else I can do it).

@janagor
janagor force-pushed the VK_EXT_descriptor_heap branch from 19aa049 to efaa94d Compare August 6, 2026 13:00
@janagor

janagor commented Aug 6, 2026

Copy link
Copy Markdown
Author

I rebased over master as requested.

Albert and others added 11 commits August 6, 2026 15:16
Fix: applied coding style

Fix: Fixed Vulkan pNext chain when using both Dynamic Rendering and Descriptor Heaps.
…te heap API with IMGUI_IMPL_VULKAN_HAS_DESCRIPTOR_HEAP, and load vkCmdPushDataEXT via vkGetDeviceProcAddr.

Fix: Fix pNext chain overwrite in pipeline creation
…isallow AddTexture when DescriptorHeapInfo is set
…nfo UnRegisterImage like DX12 SrvDescriptorFreeFn

Fix: Rename target glsl_shader_heap file in validation command to match the existing one
Chore: Add changelog note scratch regarding adding support for VK_EXT_descriptor_heap

Examples: Remove and shorten the old comment info
@ocornut
ocornut force-pushed the VK_EXT_descriptor_heap branch from efaa94d to 89601b2 Compare August 6, 2026 13:16
@ocornut

ocornut commented Aug 6, 2026

Copy link
Copy Markdown
Owner

There were lots of unrelated commits that I removed now, also squashed a few of your commits.
How does this compare to #9437 ?

@janagor

janagor commented Aug 6, 2026

Copy link
Copy Markdown
Author
  • Moved the example from example_win32_vulkan to example_glfw_vulkan, using a DX12-style free-list allocator as suggested. Because the extension is still new, the example enables heaps when available and adds --require-descriptor-heap to require them (or exit).
  • Gated the feature with IMGUI_IMPL_VULKAN_HAS_DESCRIPTOR_HEAP, same idea as IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING.
  • Kept Backends: Vulkan: Add VK_EXT_descriptor_heap support (#9374) #9437’s RegisterImage / UnRegisterImage callbacks, but disabled pool-path AddTexture / RemoveTexture when using heap (those only apply to descriptor sets).
  • Some minor fixes: pNext chaining when combining dynamic rendering with heap pipeline flags, shader validation, formatting.
  • Added documentation regarding required extensions and descriptor-heap usage.

In short, this PR is based on #9437 and is meant to replace it.

@ocornut

ocornut commented Aug 6, 2026

Copy link
Copy Markdown
Owner

This needs to be simplified. All 5 examples should support the same thing, so perhaps a shared optional helper in imgui_impl_vulkan.cpp can be considered.

@janagor

janagor commented Aug 6, 2026

Copy link
Copy Markdown
Author

Okay, I will then move the free-list, bindings, and checks for required extentions into an optional helper and use it in all of the Vulkan examples.

@ocornut

ocornut commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Okay, I will then move the free-list, bindings, and checks for required extentions into an optional helper and use it in all of the Vulkan examples.

To simplify back and forth, while this in the work it's ok if you update a single example.
But the aim is to simplify code on both sides of the fence and once we are happy with it we can replicate in all 5 examples.
Right now there's +340 lines in main.cpp, that's not ideal.

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.

Add support for VK_EXT_descriptor_heap

2 participants