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

Add: GUI option to select video driver. #8816

Closed
wants to merge 2 commits into from

Conversation

michicc
Copy link
Member

@michicc michicc commented Mar 7, 2021

Motivation / Problem

Hardware GPU acceleration doesn't always behave as expected and performance results may vary.

Description

As we will never be able to test any possible GPU/driver/OS combination, expose the video driver setting to the GUI.

Limitations

It is not possible to modify driver parameters via the GUI. Also, selecting an entry on the drop-down will silently drop all driver parameters from the config file.

It takes the cheap way and makes the user do the game restart.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

Also use this opportunity to store driver factory strings as std::string.
@michicc
Copy link
Member Author

michicc commented Mar 7, 2021

This would be an alternative that closes #8812.

@TrueBrain
Copy link
Member

TrueBrain commented Mar 7, 2021

One problem with the current implementation of this approach: if you select a video driver (like sdl-opengl) that doesn't work, it does not fall back to sdl and fails with an error:

Error: Unable to load driver 'sdl-opengl'. The error was: SDL2: Can't active GL context

There is no user-clear way to recover from this now.

An option could be that if the indicated video-driver fails to load, the next acceptable video-driver is used and the user is shown: "Failed to load OpenGL; using SDL instead" in an error box on startup, to indicate this change.

@michicc
Copy link
Member Author

michicc commented Mar 7, 2021

Yeah, that is a general problem. So far any explicit driver (or blitter) specification (either via config or via command line) is treated as "work or die". Changing this to just be a suggestion would be a marked difference.

This is mainly what lead me to make #8812 first, as that allows graceful recovery.

@nielsmh
Copy link
Contributor

nielsmh commented Mar 8, 2021

I think it would be useful to also show the currently active video driver next to the setting, along with whether it was auto-selected, or perhaps selected as fallback because the user's choice failed to start.

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

Successfully merging this pull request may close these issues.

None yet

3 participants