Backends: Vulkan: Pipeline with dynamic rendering created for viewport should have its own rendering create info #8686
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where the attachment color format provided for dynamic rendering in ImGui_ImplVulkan_InitInfo does not match the surface format. A validation error occurs for viewports created outside the main window.
[{ Validation }]: Name: VUID-vkCmdDrawIndexed-dynamicRenderingUnusedAttachments-08910, Message: vkCmdDrawIndexed(): VkRenderingInfo::pColorAttachments[0].imageView format (VK_FORMAT_B8G8R8A8_UNORM) must match the corresponding format in VkPipelineRenderingCreateInfo::pColorAttachmentFormats[0] (VK_FORMAT_R16G16B16A16_SFLOAT).Dynamic rendering does not require rendering directly to the swapchain. Instead, the rendering output can be directed to a separate image—potentially with a different format, resolution, etc.—and then blitted or copied to the swapchain image. This allows pipelines to render to images with formats that differ from the swapchain's format.
In the case of ImGui, the viewport uses a separate pipeline. Naturally, this pipeline should have its own
VkPipelineRenderingCreateInfo, which allows specifying surface format formats which is taken from swapchain image which is a attached output for separate ImGui window. As a result, format mismatches are not an issue in this scenario.To reproduce this issue.
auto desired_rendering_format = VK_FORMAT_R16G16B16A16_SFLOATImGui_ImplVulkan_InitInfo{ .PipelineRenderingCreateInfo = VkPipelineRenderingCreateInfo{ ... .pColorAttachmentFormats =&desired_rendering_format }