mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Backends: Vulkan: use PipelineRenderingCreateInfo for dynamic rendering (#7166, #6855, #5446, #5037)
This commit is contained in:
		| @@ -33,10 +33,11 @@ | ||||
|  | ||||
| // CHANGELOG | ||||
| // (minor and older changes stripped away, please see git history for details) | ||||
| //  2024-02-12: *BREAKING CHANGE*: Dynamic rendering now require filling PipelineRenderingCreateInfo structure. | ||||
| //  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. | ||||
| //  2024-01-03: Vulkan: Stopped creating command pools with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT as we don't reset them. | ||||
| //  2023-11-29: Vulkan: Fixed mismatching allocator passed to vkCreateCommandPool() vs vkDestroyCommandPool(). (#7075) | ||||
| //  2023-11-10: *BREAKING CHANGE*: Removed parameter from ImGui_ImplVulkan_CreateFontsTexture(): backend now creates its own command-buffer to upload fonts. | ||||
| //              *BREAKING CHANGE*: Removed ImGui_ImplVulkan_DestroyFontUploadObjects() which is now unecessary as we create and destroy those objects in the backend. | ||||
| @@ -953,13 +954,11 @@ static void ImGui_ImplVulkan_CreatePipeline(VkDevice device, const VkAllocationC | ||||
|     info.subpass = subpass; | ||||
|  | ||||
| #ifdef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING | ||||
|     VkPipelineRenderingCreateInfoKHR pipelineRenderingCreateInfo = {}; | ||||
|     pipelineRenderingCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR; | ||||
|     pipelineRenderingCreateInfo.colorAttachmentCount = 1; | ||||
|     pipelineRenderingCreateInfo.pColorAttachmentFormats = &bd->VulkanInitInfo.ColorAttachmentFormat; | ||||
|     IM_ASSERT(bd->VulkanInitInfo.PipelineRenderingCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR && "PipelineRenderingCreateInfo sType must be VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR"); | ||||
|     IM_ASSERT(bd->VulkanInitInfo.PipelineRenderingCreateInfo.pNext == nullptr && "PipelineRenderingCreateInfo pNext must be NULL"); | ||||
|     if (bd->VulkanInitInfo.UseDynamicRendering) | ||||
|     { | ||||
|         info.pNext = &pipelineRenderingCreateInfo; | ||||
|         info.pNext = &bd->VulkanInitInfo.PipelineRenderingCreateInfo; | ||||
|         info.renderPass = VK_NULL_HANDLE; // Just make sure it's actually nullptr. | ||||
|     } | ||||
| #endif | ||||
|   | ||||
| @@ -54,6 +54,9 @@ | ||||
| #endif | ||||
|  | ||||
| // Initialization data, for ImGui_ImplVulkan_Init() | ||||
| // - VkDescriptorPool should be created with VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, | ||||
| //   and must contain a pool size large enough to hold an ImGui VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER descriptor. | ||||
| // - When using dynamic rendering, set UseDynamicRendering=true and fill PipelineRenderingCreateInfo structure. | ||||
| // [Please zero-clear before use!] | ||||
| struct ImGui_ImplVulkan_InitInfo | ||||
| { | ||||
| @@ -62,18 +65,21 @@ struct ImGui_ImplVulkan_InitInfo | ||||
|     VkDevice                        Device; | ||||
|     uint32_t                        QueueFamily; | ||||
|     VkQueue                         Queue; | ||||
|     VkDescriptorPool                DescriptorPool;               // See requirements in note above | ||||
|     uint32_t                        MinImageCount;                // >= 2 | ||||
|     uint32_t                        ImageCount;                   // >= MinImageCount | ||||
|     VkSampleCountFlagBits           MSAASamples;                  // 0 defaults to VK_SAMPLE_COUNT_1_BIT | ||||
|  | ||||
|     // (Optional) | ||||
|     VkPipelineCache                 PipelineCache; | ||||
|     VkDescriptorPool                DescriptorPool; | ||||
|     uint32_t                        Subpass; | ||||
|     uint32_t                        MinImageCount;          // >= 2 | ||||
|     uint32_t                        ImageCount;             // >= MinImageCount | ||||
|     VkSampleCountFlagBits           MSAASamples;            // >= VK_SAMPLE_COUNT_1_BIT (0 -> default to VK_SAMPLE_COUNT_1_BIT) | ||||
|  | ||||
|     // Dynamic Rendering (Optional) | ||||
|     bool                            UseDynamicRendering;    // Need to explicitly enable VK_KHR_dynamic_rendering extension to use this, even for Vulkan 1.3. | ||||
|     VkFormat                        ColorAttachmentFormat;  // Required for dynamic rendering | ||||
|     // (Optional) Dynamic Rendering | ||||
|     // Need to explicitly enable VK_KHR_dynamic_rendering extension to use this, even for Vulkan 1.3. | ||||
|     bool                            UseDynamicRendering; | ||||
|     VkPipelineRenderingCreateInfoKHR PipelineRenderingCreateInfo; | ||||
|  | ||||
|     // Allocation, Debugging | ||||
|     // (Optional) Allocation, Debugging | ||||
|     const VkAllocationCallbacks*    Allocator; | ||||
|     void                            (*CheckVkResultFn)(VkResult err); | ||||
|     VkDeviceSize                    MinAllocationSize;      // Minimum allocation size. Set to 1024*1024 to satisfy zealous best practices validation layer and waste a little memory. | ||||
|   | ||||
| @@ -39,6 +39,13 @@ HOW TO UPDATE? | ||||
|  VERSION 1.90.3 WIP (In Progress) | ||||
| ----------------------------------------------------------------------- | ||||
|  | ||||
| Breaking changes: | ||||
|  | ||||
| - Backends: Vulkan: Using dynamic rendering now require filling the PipelineRenderingCreateInfo | ||||
|   structure in ImGui_ImplVulkan_InitInfo, allowing to configure color/depth/stencil formats. | ||||
|   Removed ColorAttachmentFormat field previously provided for dynamic rendering. | ||||
|   (#7166, #6855, #5446, #5037) [@shawnhatori] | ||||
|  | ||||
| Other changes: | ||||
|  | ||||
| - Menus, Popups: fixed menus and popups with child window flag erroneously not displaying | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Shawn Hatori
					Shawn Hatori