Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan backend: use PipelineRenderingCreateInfo for dynamic rendering #7166

Closed
wants to merge 5 commits into from

Conversation

shawnhatori
Copy link
Contributor

@shawnhatori shawnhatori commented Dec 23, 2023

No description provided.

@shawnhatori
Copy link
Contributor Author

shawnhatori commented Dec 23, 2023

Tested locally, solves the problem referenced in #6855.
This also addresses documentation concerns discussed in #7140.

@ocornut Regarding 6695006, what is your process for patching the docking branch? Separate PR?

@shawnhatori
Copy link
Contributor Author

shawnhatori commented Dec 23, 2023

This is obviously a breaking change, but to a small number of users for the new dynamic rendering support.

I'm not sure how ImGui handles breaking changes but it would also be nice to:

  • Move optional members PipelineCache and Subpass down to their own section for clarity. This would break code for anyone who initializes the struct relying on member order.
  • Move render_pass into ImGui_ImplVulkan_InitInfo. This breaks all users. Since modern Vulkan is trending in the direction of using dynamic rendering, this may make the API a little cleaner and less confusing.

@shawnhatori
Copy link
Contributor Author

I made the above suggestions as additional commits that can be reverted if not desired.

@shawnhatori
Copy link
Contributor Author

This has been rebased with the following additional change:
I removed the call to RemoveTexture(). That call tries to free a descriptor on shutdown, which requires the caller to provide a descriptor pool with VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT set. Doing otherwise is a validation error. I don't think this should happen. Since it's a caller-supplied pool, it should be the caller's responsibility to free. Removing that call removes a major restriction on the pool a user can provide. Since I free my provided pool anyway, I have tested this new change and it runs and shuts down cleanly with no leaks.

@shawnhatori
Copy link
Contributor Author

@ocornut Any feedback on this change? I'm not sure what the project's approach is to breaking changes, but that interface cleanup can be reverted if need be.

@ocornut
Copy link
Owner

ocornut commented Feb 12, 2024

Breaking changes to specific backends like Vulkan and WebGPU are treated in a little more relaxed way than breaking changes to main lib or simpler backends. It is understood that users of those platforms are development on moving ground anyway, and can be more reactive to change.

I removed the call to RemoveTexture().

I'm very confused by this. There are 5 commits in this PR (with 2 including unrelated addition/removal) but this change seems completely unrelated to the discussion? Please open separate PR as every change is subject to discussion and most often not as easy as meet the eyes, so separately the issue is welcome.

what is your process for patching the docking branch? Separate PR?

If the PR will affect it in this case I think I can manually apply corresponding change.

@ocornut
Copy link
Owner

ocornut commented Feb 12, 2024

I merged the main proposed change as 8901931.

I didn't merge the RenderPass change because the same change would require fixing examples. Also you removed use of Subpass but left the field. And the commit has an unrelated block of changes as well. I am open to make that breaking change.

I didn't merge the texture change I would prefer a separate PR for it.

@ocornut
Copy link
Owner

ocornut commented Feb 12, 2024

Also note your PR as-is was broken and required 11d73f0 to work.

@ocornut
Copy link
Owner

ocornut commented Feb 12, 2024

Also amended with e0ba0d0 as CI failed with older VulkanSDK.

@ocornut ocornut changed the title vulkan backend: use PipelineRenderingCreateInfo for dynamic rendering Vulkan backend: use PipelineRenderingCreateInfo for dynamic rendering Feb 12, 2024
@shawnhatori
Copy link
Contributor Author

shawnhatori commented Feb 12, 2024

@ocornut Ack on the required fixes. Sorry about that - good catches.

I'm very confused by this. There are 5 commits in this PR (with 2 including unrelated addition/removal) but this change seems completely unrelated to the discussion? Please open separate PR as every change is subject to discussion and most often not as easy as meet the eyes, so separately the issue is welcome.

A number of things were discussed across two threads, which admittedly is a bit confusing. Adding to the confusion (for myself at least) is that this PR is two months old. So I will try to centralize everything here:

  1. Backends: Vulkan: Modifiable depth and stencil formats #6855, which is about providing the VkPipelineRenderingCreateInfoKHR to prevent the validation errors. This is the PR you submitted your follow-up comment to and it has been addressed with the commit that has been merged.
  2. Vulkan Backend: validation error/exception on ImGui_ImplVulkan_AddTexture() call to vkUpdateDescriptorSets() #7140 (comment), where I raise:
  • Clarifications in the Vulkan backend documentation for how to use it and which members are optional (also merged)
  • VkRenderPass being a separate parameter
  • The RemoveTexture() issue

These all got rolled into one since I was living off of my branch and fixed any related validation errors I came across. Agreed that these last two should be part of separate PRs. I will do that.

Also you removed use of Subpass but left the field.

Yes, the confusion here was that Subpass is a member of both ImGui_ImplVulkan_InitInfo and ImGui_ImplVulkan_Data, where the Data member is just a copy of the Info member. There may be a good reason for this that I'm not aware of, in which case I can leave it as-is. Note that RenderPass will have the same problem if it is moved into the Info struct (as proposed, instead of taking it in as a parameter), as it is also in the Data struct. It seems to me that these members can stay in Info and be removed from Data, since they can always be accessed from the Info struct within imgui_impl_vulkan.cpp. But I will wait for your feedback on that.

@ocornut
Copy link
Owner

ocornut commented Feb 12, 2024

Yes, the confusion here was that Subpass is a member of both ImGui_ImplVulkan_InitInfo and ImGui_ImplVulkan_Data, where the Data member is just a copy of the Info member. There may be a good reason for this that I'm not aware of, in which case I can leave it as-is. Note that RenderPass will have the same problem if it is moved into the Info struct (as proposed, instead of taking it in as a parameter), as it is also in the Data struct. It seems to me that these members can stay in Info and be removed from Data, since they can always be accessed from the Info struct within imgui_impl_vulkan.cpp. But I will wait for your feedback on that.

Yes we don't need two copies, but your PR left an unused field.
And the RenderPass breaking would need examples's main.cpp to be updated accordingly.

@shawnhatori
Copy link
Contributor Author

Okay the new PRs are up that should address the concerns raised above:
#7307
#7308

Since the change this PR was primarily about has been merged and we now have the other two, feel free to close this one.

@ocornut ocornut closed this Feb 12, 2024
@shawnhatori shawnhatori deleted the vk-dr-fix branch February 12, 2024 20:33
ocornut added a commit that referenced this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants