Merge pull request #95887 from bruvzg/sysinfo_drv

Update rendering driver name on fallbacks. Fix rendering driver/method in the editor system info.
This commit is contained in:
Rémi Verschelde 2024-09-03 11:43:12 +02:00
commit 262c8da104
No known key found for this signature in database
GPG Key ID: C3336907360768E1
7 changed files with 32 additions and 14 deletions

View File

@ -111,9 +111,6 @@ protected:
virtual void initialize() = 0;
virtual void initialize_joypads() = 0;
void set_current_rendering_driver_name(const String &p_driver_name) { _current_rendering_driver_name = p_driver_name; }
void set_current_rendering_method(const String &p_name) { _current_rendering_method = p_name; }
void set_display_driver_id(int p_display_driver_id) { _display_driver_id = p_display_driver_id; }
virtual void set_main_loop(MainLoop *p_main_loop) = 0;
@ -131,6 +128,9 @@ public:
static OS *get_singleton();
void set_current_rendering_driver_name(const String &p_driver_name) { _current_rendering_driver_name = p_driver_name; }
void set_current_rendering_method(const String &p_name) { _current_rendering_method = p_name; }
String get_current_rendering_driver_name() const { return _current_rendering_driver_name; }
String get_current_rendering_method() const { return _current_rendering_method; }

View File

@ -167,6 +167,10 @@
#include "modules/modules_enabled.gen.h" // For gdscript, mono.
#if defined(GLES3_ENABLED)
#include "drivers/gles3/rasterizer_gles3.h"
#endif
EditorNode *EditorNode::singleton = nullptr;
static const String EDITOR_NODE_CONFIG_SECTION = "EditorNode";
@ -5016,8 +5020,8 @@ String EditorNode::_get_system_info() const {
#ifdef LINUXBSD_ENABLED
const String display_server = OS::get_singleton()->get_environment("XDG_SESSION_TYPE").capitalize().replace(" ", ""); // `replace` is necessary, because `capitalize` introduces a whitespace between "x" and "11".
#endif // LINUXBSD_ENABLED
String driver_name = GLOBAL_GET("rendering/rendering_device/driver");
String rendering_method = GLOBAL_GET("rendering/renderer/rendering_method");
String driver_name = OS::get_singleton()->get_current_rendering_driver_name().to_lower();
String rendering_method = OS::get_singleton()->get_current_rendering_method().to_lower();
const String rendering_device_name = RenderingServer::get_singleton()->get_video_adapter_name();
@ -5053,12 +5057,23 @@ String EditorNode::_get_system_info() const {
rendering_method = "Mobile";
} else if (rendering_method == "gl_compatibility") {
rendering_method = "Compatibility";
driver_name = GLOBAL_GET("rendering/gl_compatibility/driver");
}
if (driver_name == "vulkan") {
driver_name = "Vulkan";
} else if (driver_name.begins_with("opengl3")) {
driver_name = "GLES3";
} else if (driver_name == "d3d12") {
driver_name = "Direct3D 12";
#if defined(GLES3_ENABLED)
} else if (driver_name == "opengl3_angle") {
driver_name = "OpenGL ES 3/ANGLE";
} else if (driver_name == "opengl3_es") {
driver_name = "OpenGL ES 3";
} else if (driver_name == "opengl3") {
if (RasterizerGLES3::is_gles_over_gl()) {
driver_name = "OpenGL 3";
} else {
driver_name = "OpenGL ES 3";
}
#endif
} else if (driver_name == "metal") {
driver_name = "Metal";
}

View File

@ -2327,15 +2327,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
}
// note this is the desired rendering driver, it doesn't mean we will get it.
// TODO - make sure this is updated in the case of fallbacks, so that the user interface
// shows the correct driver string.
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
OS::get_singleton()->set_current_rendering_method(rendering_method);
// always convert to lower case for consistency in the code
rendering_driver = rendering_driver.to_lower();
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
OS::get_singleton()->set_current_rendering_method(rendering_method);
if (use_custom_res) {
if (!force_res) {
window_size.width = GLOBAL_GET("display/window/size/viewport_width");

View File

@ -1429,6 +1429,7 @@ DisplayServerWayland::DisplayServerWayland(const String &p_rendering_driver, Win
if (fallback) {
WARN_PRINT("Your video card drivers seem not to support the required OpenGL version, switching to OpenGLES.");
rendering_driver = "opengl3_es";
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
} else {
r_error = ERR_UNAVAILABLE;
ERR_FAIL_MSG("Could not initialize OpenGL.");

View File

@ -6231,6 +6231,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (fallback) {
WARN_PRINT("Your video card drivers seem not to support the required OpenGL version, switching to OpenGLES.");
rendering_driver = "opengl3_es";
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
} else {
r_error = ERR_UNAVAILABLE;
ERR_FAIL_MSG("Could not initialize OpenGL.");

View File

@ -3615,6 +3615,7 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM
WARN_PRINT("Your video card drivers seem not to support GLES3 / ANGLE or ANGLE dynamic libraries (libEGL.dylib and libGLESv2.dylib) are missing, switching to native OpenGL.");
#endif
rendering_driver = "opengl3";
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
} else {
r_error = ERR_UNAVAILABLE;
ERR_FAIL_MSG("Could not initialize ANGLE OpenGL.");

View File

@ -6150,6 +6150,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
if (rendering_context->initialize() == OK) {
WARN_PRINT("Your video card drivers seem not to support Direct3D 12, switching to Vulkan.");
rendering_driver = "vulkan";
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
failed = false;
}
}
@ -6163,6 +6164,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
if (rendering_context->initialize() == OK) {
WARN_PRINT("Your video card drivers seem not to support Vulkan, switching to Direct3D 12.");
rendering_driver = "d3d12";
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
failed = false;
}
}
@ -6241,6 +6243,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
}
}
rendering_driver = "opengl3_angle";
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
}
}