VideoBackends:Vulkan: Allocate descriptor pools as needed #11122
+115
−95
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.
Dolphin currently creates one massive descriptor pool per frame. If it ever runs out of descriptors or descriptor sets,
it executes the current command buffer, hoping that will result in a fresh pool.
The problem is that after #11090, executing the current command buffer will not result in a fresh descriptor pool.
That PR decoupled command buffers and descriptor pools to allow us to use more command buffers which in turn reduces
potential waiting for the previous one to finish when flushing more often (mostly on weak mobile GPUs).
So right now, when descriptor set allocation fails, it just starts a new command buffer and then tries again with the exact same descriptor pool. I don't know how often this actually happens in games, given that the descriptor pool is pretty huge but we should still fix this.
So instead of just using 1 fixed pool per frame, I now create them as needed. I also picked way smaller descriptor and set counts because it will just create as many sets as necessary.
This should also reduce memory usage ever so slightly but that depends on the Vulkan driver and I don't think it's significant so I haven't measured it.