|
@@ -35,6 +35,7 @@
|
|
|
// CHANGELOG
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
// 2024-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
|
|
+// 2024-01-19: Vulkan: Fixed vkAcquireNextImageKHR() validation errors in VulkanSDK 1.3.275 by allocating one extra semaphore than in-flight frames. (#7236)
|
|
|
// 2024-01-11: Vulkan: Fixed vkMapMemory() calls unnecessarily using full buffer size (#3957). Fixed MinAllocationSize handing (#7189).
|
|
|
// 2024-01-03: Vulkan: Added MinAllocationSize field in ImGui_ImplVulkan_InitInfo to workaround zealous "best practice" validation layer. (#7189, #4238)
|
|
|
// 2024-01-03: Vulkan: Stoped creating command pools with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT as we don't reset them.
|
|
@@ -1354,15 +1355,13 @@ VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_d
|
|
|
void ImGui_ImplVulkanH_CreateWindowCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wd, uint32_t queue_family, const VkAllocationCallbacks* allocator)
|
|
|
{
|
|
|
IM_ASSERT(physical_device != VK_NULL_HANDLE && device != VK_NULL_HANDLE);
|
|
|
- (void)physical_device;
|
|
|
- (void)allocator;
|
|
|
+ IM_UNUSED(physical_device);
|
|
|
|
|
|
// Create Command Buffers
|
|
|
VkResult err;
|
|
|
for (uint32_t i = 0; i < wd->ImageCount; i++)
|
|
|
{
|
|
|
ImGui_ImplVulkanH_Frame* fd = &wd->Frames[i];
|
|
|
- ImGui_ImplVulkanH_FrameSemaphores* fsd = &wd->FrameSemaphores[i];
|
|
|
{
|
|
|
VkCommandPoolCreateInfo info = {};
|
|
|
info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
|
@@ -1387,6 +1386,11 @@ void ImGui_ImplVulkanH_CreateWindowCommandBuffers(VkPhysicalDevice physical_devi
|
|
|
err = vkCreateFence(device, &info, allocator, &fd->Fence);
|
|
|
check_vk_result(err);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ for (uint32_t i = 0; i < wd->SemaphoreCount; i++)
|
|
|
+ {
|
|
|
+ ImGui_ImplVulkanH_FrameSemaphores* fsd = &wd->FrameSemaphores[i];
|
|
|
{
|
|
|
VkSemaphoreCreateInfo info = {};
|
|
|
info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
|
@@ -1422,10 +1426,9 @@ void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, V
|
|
|
// We don't use ImGui_ImplVulkanH_DestroyWindow() because we want to preserve the old swapchain to create the new one.
|
|
|
// Destroy old Framebuffer
|
|
|
for (uint32_t i = 0; i < wd->ImageCount; i++)
|
|
|
- {
|
|
|
ImGui_ImplVulkanH_DestroyFrame(device, &wd->Frames[i], allocator);
|
|
|
+ for (uint32_t i = 0; i < wd->SemaphoreCount; i++)
|
|
|
ImGui_ImplVulkanH_DestroyFrameSemaphores(device, &wd->FrameSemaphores[i], allocator);
|
|
|
- }
|
|
|
IM_FREE(wd->Frames);
|
|
|
IM_FREE(wd->FrameSemaphores);
|
|
|
wd->Frames = nullptr;
|
|
@@ -1484,11 +1487,12 @@ void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, V
|
|
|
err = vkGetSwapchainImagesKHR(device, wd->Swapchain, &wd->ImageCount, backbuffers);
|
|
|
check_vk_result(err);
|
|
|
|
|
|
- IM_ASSERT(wd->Frames == nullptr);
|
|
|
+ IM_ASSERT(wd->Frames == nullptr && wd->FrameSemaphores == nullptr);
|
|
|
+ wd->SemaphoreCount = wd->ImageCount + 1;
|
|
|
wd->Frames = (ImGui_ImplVulkanH_Frame*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_Frame) * wd->ImageCount);
|
|
|
- wd->FrameSemaphores = (ImGui_ImplVulkanH_FrameSemaphores*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_FrameSemaphores) * wd->ImageCount);
|
|
|
+ wd->FrameSemaphores = (ImGui_ImplVulkanH_FrameSemaphores*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_FrameSemaphores) * wd->SemaphoreCount);
|
|
|
memset(wd->Frames, 0, sizeof(wd->Frames[0]) * wd->ImageCount);
|
|
|
- memset(wd->FrameSemaphores, 0, sizeof(wd->FrameSemaphores[0]) * wd->ImageCount);
|
|
|
+ memset(wd->FrameSemaphores, 0, sizeof(wd->FrameSemaphores[0]) * wd->SemaphoreCount);
|
|
|
for (uint32_t i = 0; i < wd->ImageCount; i++)
|
|
|
wd->Frames[i].Backbuffer = backbuffers[i];
|
|
|
}
|
|
@@ -1596,10 +1600,9 @@ void ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui
|
|
|
//vkQueueWaitIdle(bd->Queue);
|
|
|
|
|
|
for (uint32_t i = 0; i < wd->ImageCount; i++)
|
|
|
- {
|
|
|
ImGui_ImplVulkanH_DestroyFrame(device, &wd->Frames[i], allocator);
|
|
|
+ for (uint32_t i = 0; i < wd->SemaphoreCount; i++)
|
|
|
ImGui_ImplVulkanH_DestroyFrameSemaphores(device, &wd->FrameSemaphores[i], allocator);
|
|
|
- }
|
|
|
IM_FREE(wd->Frames);
|
|
|
IM_FREE(wd->FrameSemaphores);
|
|
|
wd->Frames = nullptr;
|
|
@@ -1873,8 +1876,8 @@ static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
|
|
|
else
|
|
|
check_vk_result(err);
|
|
|
|
|
|
- wd->FrameIndex = (wd->FrameIndex + 1) % wd->ImageCount; // This is for the next vkWaitForFences()
|
|
|
- wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->ImageCount; // Now we can use the next set of semaphores
|
|
|
+ wd->FrameIndex = (wd->FrameIndex + 1) % wd->ImageCount; // This is for the next vkWaitForFences()
|
|
|
+ wd->SemaphoreIndex = (wd->SemaphoreIndex + 1) % wd->SemaphoreCount; // Now we can use the next set of semaphores
|
|
|
}
|
|
|
|
|
|
void ImGui_ImplVulkan_InitPlatformInterface()
|