@@ -50,14 +50,26 @@ static const plMemoryI *gptMemory = NULL;
5050// -----------------------------------------------------------------------------
5151
5252void
53- pl_dear_imgui_initialize (plDevice *ptDevice, plSwapchain *ptSwap, plRenderPassHandle tMainRenderPass )
53+ pl_dear_imgui_initialize (plDevice *ptDevice, plSwapchain *ptSwap, const plRenderAttachmentFormatInfo* ptInfo )
5454{
5555
5656 ImPlotContext *ptImPlotContext = ImPlot::CreateContext ();
5757 gptDataRegistry->set_data (" implot" , ptImPlotContext);
5858
5959#ifdef PL_CPU_BACKEND
6060#elif defined(PL_VULKAN_BACKEND)
61+
62+ VkFormat atColorFormats[PL_MAX_RENDER_TARGETS ] = {};
63+ for (uint32_t i = 0 ; i < ptInfo->uColorCount ; i++)
64+ atColorFormats[i] = gptGfx->get_vulkan_format (ptInfo->atColorFormats [i]);
65+ VkPipelineRenderingCreateInfo tPipelineRenderingCreateInfo = {};
66+ tPipelineRenderingCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO ;
67+ tPipelineRenderingCreateInfo.pNext = NULL ;
68+ tPipelineRenderingCreateInfo.colorAttachmentCount = ptInfo->uColorCount ;
69+ tPipelineRenderingCreateInfo.pColorAttachmentFormats = atColorFormats;
70+ tPipelineRenderingCreateInfo.depthAttachmentFormat = ptInfo->tDepthFormat == 0 ? VK_FORMAT_UNDEFINED : gptGfx->get_vulkan_format (ptInfo->tDepthFormat );
71+ tPipelineRenderingCreateInfo.stencilAttachmentFormat = ptInfo->tStencilFormat == 0 ? VK_FORMAT_UNDEFINED : gptGfx->get_vulkan_format (ptInfo->tStencilFormat );
72+
6173 ImGui_ImplVulkan_InitInfo tImguiVulkanInfo = PL_ZERO_INIT ;
6274 tImguiVulkanInfo.ApiVersion = gptGfx->get_vulkan_api_version ();
6375 tImguiVulkanInfo.Instance = gptGfx->get_vulkan_instance ();
@@ -68,11 +80,14 @@ pl_dear_imgui_initialize(plDevice *ptDevice, plSwapchain *ptSwap, plRenderPassHa
6880 // tImguiVulkanInfo.DescriptorPool = gptGfx->get_vulkan_descriptor_pool(gptDraw->get_bind_group_pool());
6981 tImguiVulkanInfo.DescriptorPoolSize = 100000 ;
7082 tImguiVulkanInfo.MinImageCount = 2 ;
83+ tImguiVulkanInfo.UseDynamicRendering = true ;
7184 tImguiVulkanInfo.Allocator = gptGfx->get_vulkan_allocation_callbacks ();
7285 tImguiVulkanInfo.PipelineInfoMain .MSAASamples = (VkSampleCountFlagBits)gptGfx->get_swapchain_info (ptSwap).tSampleCount ;
73- tImguiVulkanInfo.PipelineInfoMain .RenderPass = gptGfx->get_vulkan_render_pass (ptDevice, tMainRenderPass);
86+ tImguiVulkanInfo.PipelineInfoMain .PipelineRenderingCreateInfo = tPipelineRenderingCreateInfo;
87+ tImguiVulkanInfo.PipelineInfoForViewports .PipelineRenderingCreateInfo = tPipelineRenderingCreateInfo;
88+ // tImguiVulkanInfo.PipelineInfoMain.RenderPass = gptGfx->get_vulkan_render_pass(ptDevice, tMainRenderPass);
7489 tImguiVulkanInfo.PipelineInfoForViewports .MSAASamples = (VkSampleCountFlagBits)gptGfx->get_swapchain_info (ptSwap).tSampleCount ;
75- tImguiVulkanInfo.PipelineInfoForViewports .RenderPass = gptGfx->get_vulkan_render_pass (ptDevice, tMainRenderPass);
90+ // tImguiVulkanInfo.PipelineInfoForViewports.RenderPass = gptGfx->get_vulkan_render_pass(ptDevice, tMainRenderPass);
7691 gptGfx->get_swapchain_images (ptSwap, &tImguiVulkanInfo.ImageCount );
7792 ImGui_ImplVulkan_Init (&tImguiVulkanInfo);
7893#elif defined(PL_METAL_BACKEND)
@@ -97,7 +112,7 @@ pl_dear_imgui_cleanup(void)
97112}
98113
99114void
100- pl_dear_imgui_new_frame (plDevice *ptDevice, plRenderPassHandle tMainRenderPass )
115+ pl_dear_imgui_new_frame (plDevice *ptDevice)
101116{
102117#ifdef PL_CPU_BACKEND
103118#elif defined(PL_VULKAN_BACKEND)
0 commit comments