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
Try all known video drivers if the requested one fails to initialize #13284
Conversation
@numberZero any updates on this? |
src/client/renderingengine.cpp
Outdated
if (!m_device) | ||
throw std::runtime_error("Could not initialize the device with any supported video driver"); |
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.
This part would be good to get in; without it the process crashes on the next line when createDeviceEx()
fails.
I might throw another type of exception because runtime_error
results in dumping a core, which is useless for this error and a bit severe. Maybe the existing ClientStateError
or roll your own video-specific exception type?
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.
ClientStateError
is definitely wrong choice, it is used in the server to denote that there is something wrong with the client. And, what’s the point in using another exception type if no exceptions are caught up the call stack anyway?
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.
And, what’s the point in using another exception type if no exceptions are caught up the call stack anyway?
As I said, left uncaught this exception can result in a core file, which while useful for debugging in general, doesn't have much use here. It's just nicer to not litter the user's machine with such files for lack of a more appropriate exception type, but I guess there are lots of ways to disable core files at the OS level so I can deal with it. It's just a good code hygiene suggestion.
17d1b11
to
d8b4e60
Compare
d8b4e60
to
5e99ad8
Compare
Not just rebased, this should work now) |
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.
LGTM.
Sometimes, “best” available video driver isn’t at all best, or even working. With this PR, if the configured video driver fails to initialize, Minetest will try each other supported video driver, in order of decreasing preference, until it finds one that works (initializes successfully).