Fix: disable hardware acceleration when GPU driver crashed the game last attempt #10928
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
We have a slow but steady report of "game crashes on startup" over the last few months. All these cases come down to:
This leaves the user confused, and they have to dig through tons of things to find out they have to add
-v win32
to start the game. Only then they can disable hardware acceleration.I was wondering: can't we detect if we crashed, and on next start, disable hardware acceleration for the user?
Fixes #10463
Fixes #10394
Fixes #10571
Description
I build this PR on the assumption that
Start()
causes the driver crash. A few backtraces show this is the case, but a few others we cannot decode; so I am not sure this covers all cases. It might still happen that a crash happens when we actually start drawing for the first time, but we can always extend this code to that later on. For example, by waiting for the first tick to remove the detection file.Either way, this PR creates a file
hwaccel.dat
when starting with hardware acceleration. As soon as the first drawing tick finishes, we remove it again. If we try to initialize the video driver with acceleration while that file exist, it means we must have crashed last time. We then disable hardware acceleration.PS: some changes recently caused those video-driver errors to no longer show up, as they weren't marked critical (any more). I fixed that while I was here. No clue what happened exactly; it used to work, it no longer does, it does now again. shrug
Limitations
Ideally, we find out what gets those drivers to crash; but that has turned out to be very difficult, and often just: known driver bug. Some people seem to never update their drivers, other GPUs haven't release a new drivers in months, and just randomly crash.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.