-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Fix Vulkan examples descriptor pool setup #6642
Fix Vulkan examples descriptor pool setup #6642
Conversation
Only use required no. of types and sets
Thank you. |
A bigger value wouldn't make any sense with regards to the sample. If an application uses ImGui it'll most probably use it's own pool anyway, and the setup for that pool would be pretty specific to that application. I also added a command above the setup as to why the pool is setup like it is. |
The idea is that if someone wants to try something like https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples in examples or as part of a test bed derived from it, which is subject to many types of user errors in the first place, this remove one point of failure for the “quick attempt at getting this working”. |
Sure, but the current approach of creating an insanely large pool may fail on implementations with smaller pool size limits and also teaches bad practices. On the other hand, if you allocate with a pool that's too small you'll get a validation error and (depending on the implementation) an error at allocation time that tells you that you need to increase the pool size. For a low-level api like Vulkan, there is no solution that fits all use cases, so this needs to be handled at the documentation level. Besides, if someone wanted to display a Vulkan image inside ImGui that person already would've needed to allocate that image from their apps pool. The "correct" way is to have the host application setup a pool and the pass that to the Vulkan functions of ImGui. or don't use the Vulkan functions provided by ImGui at all and have the host application deal with it, which is the most flexible way. |
I may misunderstand something but surely it wouldn’t hurt to change that 1 to eg 5 or 10 and comment explicitly that the app as-is needs only 1, but it lower barrier for newcomer to try adding a texture. They’ll see the barrier soon enough if they want to scale to more, but if it’s not an initially blocking barrier it decreases likehood of newbies giving up. Basically we want a simple attempt to use ImGui_ImplVulkan_AddTexture() to be more likely to work without making mods to existing code, just adding code. For better or worse, many people use those samples as defacto starter apps so there is a little responsibility to make that as friendly as we can. I understand the old setup with 1000 of everything was absurd but I am arguing for 10 of one type for the purpose of making things easier for newcomers toying with things they don’t yet understand. |
5 or 10 are just different arbitrary limits. I still think this is a documentation issue, and if the sample contains proper comments that tell people about having to adjust the descriptor pool size for their needs that's (at least imo) fine. I think I noted it in the original PR, but trying to get ImGui_ImplVulkan_AddTexture to work in any case for any app simply won't work as descriptor handling and image/sampler creation should be the apps responsibility. But that's just my opinion, feel free to discuss ;) |
Only use required no. of types and sets
I have merged your PR (with 1 additional comment) as fa2f1bf.
I don't understand what this means or imply. I am not a Vulkan user and I kept #914 open for about 5 years hoping for people to come to a right solution and consensus and explain/convey it to me but this didn't happen. My intuition is that we should adopt an idea similar to #2697 aka let user app register a custom method for binding a ImTextureID. |
Closing this as merged. As per my last comment, still (maybe) in need of someone more pro-actively helping with the design of using textures/images as I'm not competent enough to do it. |
This PR fixes the descriptor pool setup for the Vulkan SDL2 and GLFW examples. The original code passed an unnecessary large set of pool sizes including descriptor types never actually used. It also passed a huge no. of max sets that could be allocated.
This has been changed with this PR, which adjusts the pool to what's actually used in the samples: One combined image sampler descriptor type for the font image and one descriptor set.