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

VideoCommon: Get rid of the global g_available_video_backends #9179

Merged
merged 2 commits into from Oct 23, 2020

Conversation

leoetlino
Copy link
Member

Replace it with a function-local static that is initialized on first
use. This gets rid of a global variable and removes the need for
manual initialization in UICommon.

This commit also replaces the weird find_if that looks for a non-null
unique_ptr with a simple "is vector empty" check considering that
none of the pointers can be null by construction.


Also simplifies GetDefaultBackendName: now we can just call
GetDefaultVideoBackend to get the default backend
and get its name by calling GetName.

Replace it with a function-local static that is initialized on first
use. This gets rid of a global variable and removes the need for
manual initialization in UICommon.

This commit also replaces the weird find_if that looks for a non-null
unique_ptr with a simple "is vector empty" check considering that
none of the pointers can be null by construction.
Now we can just call GetDefaultVideoBackend to get the default backend
and get its name by calling GetName.
{
// OGL > D3D11 > D3D12 > Vulkan > SW > Null
static auto s_available_backends = [] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need the lambda?

Copy link
Member Author

Choose a reason for hiding this comment

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

The lambda is just a convenient way to make sure the initialization code only runs once.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, it's static, that makes sense. Thanks!

@JosJuice JosJuice merged commit 908d6f8 into dolphin-emu:master Oct 23, 2020
10 checks passed
@RinMaru
Copy link

RinMaru commented Oct 23, 2020

Vulkan has vanished from the graphics menu after this

@leoetlino
Copy link
Member Author

Oh, that must be a regression from #7395... I'll investigate it

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