From d4e78b8db5724e529ae024eb7a97bdc0f350ab21 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:35:25 +0300 Subject: [PATCH] Store GLES over GL status in the OS to avoid direct renderer includes in the editor. --- core/os/os.h | 3 +++ drivers/gles3/rasterizer_gles3.h | 1 + editor/editor_node.cpp | 8 +------- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/os/os.h b/core/os/os.h index e6ce5277207..553ae4cf762 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -75,6 +75,7 @@ class OS { int _display_driver_id = -1; String _current_rendering_driver_name; String _current_rendering_method; + bool _is_gles_over_gl = false; RemoteFilesystemClient default_rfs; @@ -130,9 +131,11 @@ public: 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_gles_over_gl(bool p_enabled) { _is_gles_over_gl = p_enabled; } String get_current_rendering_driver_name() const { return _current_rendering_driver_name; } String get_current_rendering_method() const { return _current_rendering_method; } + bool get_gles_over_gl() const { return _is_gles_over_gl; } int get_display_driver_id() const { return _display_driver_id; } diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index 80a4a792bb2..92c96519d2a 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -113,6 +113,7 @@ public: static void make_current(bool p_gles_over_gl) { gles_over_gl = p_gles_over_gl; + OS::get_singleton()->set_gles_over_gl(gles_over_gl); _create_func = _create_current; low_end = true; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 32e6126225c..a780228a957 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -167,10 +167,6 @@ #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"; @@ -5062,18 +5058,16 @@ String EditorNode::_get_system_info() const { driver_name = "Vulkan"; } 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()) { + if (OS::get_singleton()->get_gles_over_gl()) { driver_name = "OpenGL 3"; } else { driver_name = "OpenGL ES 3"; } -#endif } else if (driver_name == "metal") { driver_name = "Metal"; }