Warn when falling back to another DisplayServer

Before it was a bit unclear on what was happening, since a display
server has to fail to fall back and so the user would be left with an
error _and_ a (hopefully) running game.

Should make the experience more pleasant on Linux/BSD now that we have
two display servers.
This commit is contained in:
Riteo 2024-05-10 01:44:57 +02:00
parent 62de80d613
commit 56eb272e90

View File

@ -2838,6 +2838,8 @@ Error Main::setup2(bool p_show_boot_logo) {
Error err;
display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, init_screen, context, err);
if (err != OK || display_server == nullptr) {
String last_name = DisplayServer::get_create_function_name(display_driver_idx);
// We can't use this display server, try other ones as fallback.
// Skip headless (always last registered) because that's not what users
// would expect if they didn't request it explicitly.
@ -2845,6 +2847,9 @@ Error Main::setup2(bool p_show_boot_logo) {
if (i == display_driver_idx) {
continue; // Don't try the same twice.
}
String name = DisplayServer::get_create_function_name(i);
WARN_PRINT(vformat("Display driver %s failed, falling back to %s.", last_name, name));
display_server = DisplayServer::create(i, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, init_screen, context, err);
if (err == OK && display_server != nullptr) {
break;