Merge pull request #95777 from Calinou/command-line-improve-rendering-driver-method-error-messages
Improve error messages for invalid rendering drivers/methods on the command line
This commit is contained in:
commit
e53dc80f2f
1 changed files with 28 additions and 2 deletions
|
@ -2188,7 +2188,20 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
if (rendering_method != "forward_plus" &&
|
if (rendering_method != "forward_plus" &&
|
||||||
rendering_method != "mobile" &&
|
rendering_method != "mobile" &&
|
||||||
rendering_method != "gl_compatibility") {
|
rendering_method != "gl_compatibility") {
|
||||||
OS::get_singleton()->print("Unknown renderer name '%s', aborting. Valid options are: %s\n", rendering_method.utf8().get_data(), renderer_hints.utf8().get_data());
|
OS::get_singleton()->print("Unknown rendering method '%s', aborting.\nValid options are ",
|
||||||
|
rendering_method.utf8().get_data());
|
||||||
|
|
||||||
|
const Vector<String> rendering_method_hints = renderer_hints.split(",");
|
||||||
|
for (int i = 0; i < rendering_method_hints.size(); i++) {
|
||||||
|
if (i == rendering_method_hints.size() - 1) {
|
||||||
|
OS::get_singleton()->print(" and ");
|
||||||
|
} else if (i != 0) {
|
||||||
|
OS::get_singleton()->print(", ");
|
||||||
|
}
|
||||||
|
OS::get_singleton()->print("'%s'", rendering_method_hints[i].utf8().get_data());
|
||||||
|
}
|
||||||
|
|
||||||
|
OS::get_singleton()->print(".\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2214,14 +2227,27 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
OS::get_singleton()->print("Unknown rendering driver '%s', aborting.\nValid options are ",
|
OS::get_singleton()->print("Unknown rendering driver '%s', aborting.\nValid options are ",
|
||||||
rendering_driver.utf8().get_data());
|
rendering_driver.utf8().get_data());
|
||||||
|
|
||||||
|
// Deduplicate driver entries, as a rendering driver may be supported by several display servers.
|
||||||
|
Vector<String> unique_rendering_drivers;
|
||||||
for (int i = 0; i < DisplayServer::get_create_function_count(); i++) {
|
for (int i = 0; i < DisplayServer::get_create_function_count(); i++) {
|
||||||
Vector<String> r_drivers = DisplayServer::get_create_function_rendering_drivers(i);
|
Vector<String> r_drivers = DisplayServer::get_create_function_rendering_drivers(i);
|
||||||
|
|
||||||
for (int d = 0; d < r_drivers.size(); d++) {
|
for (int d = 0; d < r_drivers.size(); d++) {
|
||||||
OS::get_singleton()->print("'%s', ", r_drivers[d].utf8().get_data());
|
if (!unique_rendering_drivers.has(r_drivers[d])) {
|
||||||
|
unique_rendering_drivers.append(r_drivers[d]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < unique_rendering_drivers.size(); i++) {
|
||||||
|
if (i == unique_rendering_drivers.size() - 1) {
|
||||||
|
OS::get_singleton()->print(" and ");
|
||||||
|
} else if (i != 0) {
|
||||||
|
OS::get_singleton()->print(", ");
|
||||||
|
}
|
||||||
|
OS::get_singleton()->print("'%s'", unique_rendering_drivers[i].utf8().get_data());
|
||||||
|
}
|
||||||
|
|
||||||
OS::get_singleton()->print(".\n");
|
OS::get_singleton()->print(".\n");
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Reference in a new issue