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: Option to (dis-)allow accelerated video drivers. #8812

Closed
wants to merge 2 commits into from

Conversation

michicc
Copy link
Member

@michicc michicc commented Mar 6, 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, allow users the option to allow or disallow an accelerated video driver. The video drivers using the OpenGL backend are currently our only accelerated drivers.

The options defaults to off for macOS builds and to on everywhere else.

Limitations

Default value is open to discussion. GUI could look better. 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')

@michicc michicc changed the title Codechange: Allow driver factories to decide at runtime if the driver is usable. Add: Option to (dis-)allow accelerated video drivers. Mar 6, 2021
@michicc
Copy link
Member Author

michicc commented Mar 6, 2021

GitHub, please use the commit title I want.

@TrueBrain
Copy link
Member

Just as alternative to this, should we allow selecting which video driver to use? (in a drop-down in Game Options or something).

@michicc
Copy link
Member Author

michicc commented Mar 6, 2021

For at least our release binaries, this will always be two, won't it? We don't build Allegro IIRC and we treat SDL as exclusive to everything else.

@TrueBrain
Copy link
Member

TrueBrain commented Mar 6, 2021

Indeed; for those that have compiled more, will see more, but releases will have two. I think that a dropdown makes it a bit more clear what is going on, and also a bit more future-proof. It is very close to what you already did, just a different way of naming it, but that is what I had in my head :D So just mentioning it as an alternative to this.

Similar, I would like to allow users to be able to select a different blitter in-game. So these two options go hand-in-hand :)

@spnda
Copy link
Contributor

spnda commented Mar 6, 2021

First of all, does this even work or is my CPU just too good?

Second, the GUI sizes seem a bit off...
image

The video drivers using the OpenGL backend are currently our only
accelerated drivers. The options defaults to off for macOS builds and
to on everywhere else.
@TrueBrain
Copy link
Member

TrueBrain commented Mar 7, 2021

One minor thing with the current implementation of this approach is that if you do not have OpenGL support, the "Accelerated drawing" is still enabled, giving the suggestion it is using OpenGL, but it really isn't. Mostly in games this is then disabled to reflect the current loaded situation, despite you requested another situation.

Not sure how to resolve that nicely, in terms of UX. But #8816 has a similar issue. A possible solution could be that if you have "Accelerated drawing" on, and it fails to load a driver with on, you get an error message on startup indicating you don't have accelerated drawing active, and disable the button .. but that would be a bit weird, as that changes your "preference", so if you ever do have a working OpenGL, with that config, it would never try again. Not sure how to go about this. Possibly a second indicator to tell if it is really enabled / disabled.

@michicc
Copy link
Member Author

michicc commented Mar 7, 2021

Initially I wanted to have a text like Allow accelerated drawing (restart required), but I failed in making that a nice layout in the window (like e.g. how to break text next to a checkbox).

@TrueBrain
Copy link
Member

I have been looking at this a bit, and with the timeline for 1.11, I think this is the best approach for now. I still would like to replace it with #8816 if we get the chance, but we can do this in 1.12, and make it all pretty etc. In the end, at the moment, it is better to have an option for players to disable a laggy driver, than to make the bikeshed a nice colour. And I think it is unlikely someone with a laggy game shows up with the knowledge to debug it any time soon :D

That does leave the question: can we indicate somehow if acceleration is active or not, if you don't have acceleration supported?

@nielsmh
Copy link
Contributor

nielsmh commented Mar 8, 2021

That does leave the question: can we indicate somehow if acceleration is active or not, if you don't have acceleration supported?

Show the currently active drivers in the Game Options window.

@TrueBrain
Copy link
Member

Show the currently active drivers in the Game Options window.

A bit too hidden for me. So I came up with this:

image

Text needs tuning, of course :)

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

4 participants