Skip to content

Keep track of the last bound descriptor set (Vulkan backend improvement) #8666

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

micb25
Copy link
Contributor

@micb25 micb25 commented Jun 6, 2025

This PR introduces an improvement in the Vulkan backend which reduces descriptor set changes. A local variable (last_desc_set) tracks the last bound descriptor set and avoids a rebinding the identical descriptor set. For my application, this reduced the vkCmdBindDescriptorSets calls by 67% from 19 to 7.

@ocornut
Copy link
Owner

ocornut commented Jun 6, 2025

Thank you for your PR.

this reduced the vkCmdBindDescriptorSets calls by 67% from 19 to 7.

Were you able to meaningful measure the cost of those 19 or 7 calls in a profiler?

@micb25
Copy link
Contributor Author

micb25 commented Jun 6, 2025

Thanks for your question. For these benchmarks I used a bit more complex scene that ended up in 7 vs 23 calls (patched vs unpatched) to vkCmdBindDescriptorSets. On the CPU side, it took in average 5.7 µs vs 6.4 µs (-11%) to call ImGui::Render(). On the GPU side, however, profiling with NSight Graphics didn't measure any differences (both 0.19 ms for UI rendering on a NVIDIA RTX 2060). I assume that the GPU driver keeps track of descriptor changes itself (at least NVIDIA).

Edit: I accidentally added two more commits to this PR. They have been reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants