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
VideoCommon: Get rid of the global g_available_video_backends #9179
Conversation
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.
f56ec9e
to
d08b808
Compare
| { | ||
| // OGL > D3D11 > D3D12 > Vulkan > SW > Null | ||
| static auto s_available_backends = [] { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
|
Vulkan has vanished from the graphics menu after this |
|
Oh, that must be a regression from #7395... I'll investigate it |
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.