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: Move backend_info out of VideoConfig struct. #13403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jordan-woyak
Copy link
Member

@jordan-woyak jordan-woyak commented Mar 7, 2025

I plan to clean up the way VideoConfig is handled and this is step 1.

Both g_Config and g_ActiveConfig had their own copy of backend_info. This was unnecessary since the members were just set once upon VideoBackend initialization.

I've moved backend_info from the VideoConfig struct to be its own global, BackendInfo g_backend_info. This still isn't ideal, and it should probably exist inside each VideoBackend, but it's a baby step in the right direction and I didn't want to make the changes too drastic in one PR.

This unfortunately changes a lot of files but I'll explain what I've done:

  • Replaced all occurrences of g_ActiveConfig.backend_info with g_backend_info.
  • Replaced all occurrences of g_Config.backend_info with g_backend_info.
  • Adjusted a few Vulkan/Metal functions that populated a VideoConfig to instead populate a BackendInfo.
  • Assessed that all assignments to BackendInfo members occur specifically from VideoBackend initialization.
    • The only exception that I see is bSupportsExclusiveFullscreen. Vulkan on Windows can change this during emulation, but it assigned the value in both g_Config and g_ActiveConfig simultaneously so it was still unnecessary to have two copies. I'll mention that the way this value is used across threads was pretty hacky and it still is, but I'm saving that for another day.

I see now that this is redoing work of #11531. That PR certainly has a cleaner end result, but it changes a lot and is in need of a rebase. I'm hoping we can get things moving with smaller steps like I've done here.

Copy link
Member

@BhaaLseN BhaaLseN left a comment

Choose a reason for hiding this comment

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

Pretty straight-forward change, looks good (but untested).

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.

If we're going to wait on that one change. LGTM.

@jordan-woyak
Copy link
Member Author

If we're going to wait on that one change. LGTM.

Alright, fine, I changed the one thing. :)

Copy link
Contributor

@Dentomologist Dentomologist left a comment

Choose a reason for hiding this comment

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

LGTM, slightly tested by starting up a game with a few backends.

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

Successfully merging this pull request may close these issues.

4 participants