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

VideoBackends:Vulkan: Allocate descriptor pools as needed #11122

Merged
merged 1 commit into from Oct 17, 2022

Conversation

K0bin
Copy link
Contributor

@K0bin K0bin commented Oct 6, 2022

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.

@K0bin K0bin force-pushed the descriptor-overhaul branch 2 times, most recently from d8a6341 to dafd87d Compare October 6, 2022 00:18
@TellowKrinkle
Copy link
Contributor

I don't know how often this actually happens in games, given that the descriptor pool is pretty huge

F-Zero GX runs out of SSBO descriptors (there was only 16 per pool, and it needs two for every command buffer flush) on MoltenVK (I think other drivers don't count each type separately, but MoltenVK does), which this fixes.

@Testsr
Copy link

Testsr commented Oct 13, 2022

Any progress on testing this?

@AdmiralCurtiss
Copy link
Contributor

Can someone with Vulkan knowledge do a review on this?

Copy link
Contributor

@iwubcode iwubcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested a handful of Wii titles. Code LGTM.

@AdmiralCurtiss AdmiralCurtiss merged commit 10f973a into dolphin-emu:master Oct 17, 2022
11 checks passed
@K0bin K0bin deleted the descriptor-overhaul branch October 17, 2022 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants