WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 3a45bae

Browse files
committed
Backends: Vulkan: helper for creating a swapchain selects VkSwapchainCreateInfoKHR's compositeAlpha based on cap.supportedCompositeAlpha. (#8784)
1 parent 98636f4 commit 3a45bae

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

backends/imgui_impl_vulkan.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
// CHANGELOG
2929
// (minor and older changes stripped away, please see git history for details)
30+
// 2025-11-24: Vulkan: Helper for creating a swap-chain (used by examples and multi-viewports) selects VkSwapchainCreateInfoKHR's compositeAlpha based on cap.supportedCompositeAlpha. (#8784)
3031
// 2025-10-15: Vulkan: Added IMGUI_IMPL_VULKAN_VOLK_FILENAME to configure path to volk.h header. (#9008)
3132
// 2025-09-26: *BREAKING CHANGE*: moved some fields in ImGui_ImplVulkan_InitInfo: init_info.RenderPass --> init_info.PipelineInfoMain.RenderPass, init_info.Subpass --> init_info.PipelineInfoMain.Subpass, init_info.MSAASamples --> init_info.PipelineInfoMain.MSAASamples, init_info.PipelineRenderingCreateInfo --> init_info.PipelineInfoMain.PipelineRenderingCreateInfo.
3233
// 2025-09-26: *BREAKING CHANGE*: renamed ImGui_ImplVulkan_MainPipelineCreateInfo to ImGui_ImplVulkan_PipelineInfo. Introduced very recently so shouldn't affect many users.
@@ -1637,7 +1638,12 @@ void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, V
16371638
info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | image_usage;
16381639
info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; // Assume that graphics family == present family
16391640
info.preTransform = (cap.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) ? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : cap.currentTransform;
1640-
info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
1641+
if (cap.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR)
1642+
info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
1643+
else if (cap.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR)
1644+
info.compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
1645+
else
1646+
IM_ASSERT(false && "No supported composite alpha mode found!");
16411647
info.presentMode = wd->PresentMode;
16421648
info.clipped = VK_TRUE;
16431649
info.oldSwapchain = old_swapchain;

docs/CHANGELOG.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ Other Changes:
5050
the oldest bug in Dear ImGui history (albeit for a rarely used feature)! (#9086)
5151
- Scrollbar: fixed a codepath leading to a divide-by-zero (which would not be
5252
noticeable by user but detected by sanitizers). (#9089) [@judicaelclair]
53+
- Backends:
54+
- Vulkan: helper for creating a swapchain (used by examples and multi-viewports)
55+
selects `VkSwapchainCreateInfoKHR`'s `compositeAlpha` value based on
56+
`cap.supportedCompositeAlpha`. (#8784) [@FelixStach]
5357

5458

5559
-----------------------------------------------------------------------

0 commit comments

Comments
 (0)