aboutsummaryrefslogtreecommitdiff
path: root/platform/x11/os_x11.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2018-03-01 16:04:11 +0100
committerGitHub2018-03-01 16:04:11 +0100
commit29215b229bab093bd083af4099234cbffe4febfb (patch)
treebdd2fc1a9a678422b37513a83f9bd842de532145 /platform/x11/os_x11.cpp
parent7f3024d343aa1b14641ad5a7b56efaa1501550cf (diff)
parenteac4c984dfe5eebb73b094aaf2ed5ab37b6e8fdf (diff)
downloadgodot-29215b2.tar.gz
godot-29215b2.tar.zst
godot-29215b2.zip
Merge pull request #16687 from karroffel/gles2-2d-pr
add GLES 2 renderer for 2D
Diffstat (limited to 'platform/x11/os_x11.cpp')
-rw-r--r--platform/x11/os_x11.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index c5f8e7c3c..76fc51d52 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "os_x11.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "errno.h"
#include "key_mapping_x11.h"
@@ -81,6 +82,11 @@ int OS_X11::get_video_driver_count() const {
}
const char *OS_X11::get_video_driver_name(int p_driver) const {
+ String driver_name = GLOBAL_GET("rendering/quality/driver/driver_name");
+
+ if (driver_name == "GLES2") {
+ return "GLES2";
+ }
return "GLES3";
}
@@ -283,12 +289,29 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
//print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height));
#if defined(OPENGL_ENABLED)
- context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, true));
- context_gl->initialize();
+ String setting_name = "rendering/quality/driver/driver_name";
+ ProjectSettings::get_singleton()->set_custom_property_info(setting_name, PropertyInfo(Variant::STRING, setting_name, PROPERTY_HINT_ENUM, "GLES3,GLES2"));
+ String video_driver_name = GLOBAL_DEF("rendering/quality/driver/driver_name", "GLES3");
+
+ ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
+
+ if (video_driver_name == "GLES2") {
+ opengl_api_type = ContextGL_X11::GLES_2_0_COMPATIBLE;
+ }
- RasterizerGLES3::register_config();
+ context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, opengl_api_type));
+ context_gl->initialize();
- RasterizerGLES3::make_current();
+ switch (opengl_api_type) {
+ case ContextGL_X11::GLES_2_0_COMPATIBLE: {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } break;
+ case ContextGL_X11::GLES_3_0_COMPATIBLE: {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ } break;
+ }
context_gl->set_use_vsync(current_videomode.use_vsync);