summaryrefslogtreecommitdiff
path: root/platform/linuxbsd
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/SCsub2
-rw-r--r--platform/linuxbsd/display_server_x11.cpp56
-rw-r--r--platform/linuxbsd/display_server_x11.h8
-rw-r--r--platform/linuxbsd/gl_manager_x11.cpp18
-rw-r--r--platform/linuxbsd/gl_manager_x11.h13
-rw-r--r--platform/linuxbsd/platform_config.h3
6 files changed, 53 insertions, 47 deletions
diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub
index 05393f6246..cec8706fbc 100644
--- a/platform/linuxbsd/SCsub
+++ b/platform/linuxbsd/SCsub
@@ -20,8 +20,6 @@ if "x11" in env and env["x11"]:
"key_mapping_x11.cpp",
]
-#"context_gl_x11.cpp",
-
if "vulkan" in env and env["vulkan"]:
common_linuxbsd.append("vulkan_context_x11.cpp")
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 18247deafb..4421c868d8 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -44,8 +44,8 @@
#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
#endif
-#if defined(GLES_X11_ENABLED)
-#include "drivers/gles2/rasterizer_gles2.h"
+#if defined(OPENGL_ENABLED)
+#include "drivers/opengl/rasterizer_opengl.h"
#endif
#include <limits.h>
@@ -889,7 +889,7 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {
context_vulkan->window_destroy(p_id);
}
#endif
-#ifdef GLES_X11_ENABLED
+#ifdef OPENGL_ENABLED
if (gl_manager) {
gl_manager->window_destroy(p_id);
}
@@ -1064,7 +1064,7 @@ int DisplayServerX11::window_get_current_screen(WindowID p_window) const {
}
void DisplayServerX11::gl_window_make_current(DisplayServer::WindowID p_window_id) {
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
if (gl_manager)
gl_manager->window_make_current(p_window_id);
#endif
@@ -2666,7 +2666,7 @@ void DisplayServerX11::_window_changed(XEvent *event) {
context_vulkan->window_resize(window_id, wd.size.width, wd.size.height);
}
#endif
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
if (gl_manager) {
gl_manager->window_resize(window_id, wd.size.width, wd.size.height);
}
@@ -3547,19 +3547,19 @@ void DisplayServerX11::process_events() {
}
void DisplayServerX11::release_rendering_thread() {
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
// gl_manager->release_current();
#endif
}
void DisplayServerX11::make_rendering_thread() {
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
// gl_manager->make_current();
#endif
}
void DisplayServerX11::swap_buffers() {
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
if (gl_manager) {
gl_manager->swap_buffers();
}
@@ -3710,7 +3710,7 @@ void DisplayServerX11::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mo
}
#endif
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
if (gl_manager) {
gl_manager->set_use_vsync(p_vsync_mode == DisplayServer::VSYNC_ENABLED);
}
@@ -3724,7 +3724,7 @@ DisplayServer::VSyncMode DisplayServerX11::window_get_vsync_mode(WindowID p_wind
return context_vulkan->get_vsync_mode(p_window);
}
#endif
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
if (gl_manager) {
return gl_manager->is_using_vsync() ? DisplayServer::VSYNC_ENABLED : DisplayServer::VSYNC_DISABLED;
}
@@ -3738,10 +3738,8 @@ Vector<String> DisplayServerX11::get_rendering_drivers_func() {
#ifdef VULKAN_ENABLED
drivers.push_back("vulkan");
#endif
-#ifdef GLES_X11_ENABLED
- // drivers.push_back("opengl");
- drivers.push_back("GLES2");
- drivers.push_back("GLES3");
+#ifdef OPENGL_ENABLED
+ drivers.push_back("opengl");
#endif
return drivers;
@@ -3750,7 +3748,7 @@ Vector<String> DisplayServerX11::get_rendering_drivers_func() {
DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
DisplayServer *ds = memnew(DisplayServerX11(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_resolution, r_error));
if (r_error != OK) {
- OS::get_singleton()->alert("Your video card driver does not support any of the supported Vulkan versions.\n"
+ OS::get_singleton()->alert("Your video card driver does not support any of the supported Vulkan or OpenGL versions.\n"
"Please update your drivers or if you have a very old or integrated GPU, upgrade it.\n"
"If you have updated your graphics drivers recently, try rebooting.",
"Unable to initialize Video driver");
@@ -3926,11 +3924,11 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create a Vulkan window");
}
#endif
-#ifdef GLES_X11_ENABLED
+#ifdef OPENGL_ENABLED
print_line("rendering_driver " + rendering_driver);
if (gl_manager) {
Error err = gl_manager->window_create(id, wd.x11_window, x11_display, p_rect.size.width, p_rect.size.height);
- ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create a GLES2 window");
+ ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't create an OpenGL window");
}
#endif
@@ -4114,15 +4112,13 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
xdnd_selection = XInternAtom(x11_display, "XdndSelection", False);
//!!!!!!!!!!!!!!!!!!!!!!!!!!
- //TODO - do Vulkan and GLES2 support checks, driver selection and fallback
+ //TODO - do Vulkan and OpenGL support checks, driver selection and fallback
rendering_driver = p_rendering_driver;
#ifndef _MSC_VER
//#warning Forcing vulkan rendering driver because OpenGL not implemented yet
//#warning Forcing opengl rendering driver because selecting properly is too much effort
#endif
- // rendering_driver = "vulkan";
- //rendering_driver = "GLES2";
bool driver_found = false;
#if defined(VULKAN_ENABLED)
@@ -4138,9 +4134,9 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
#endif
// Init context and rendering device
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
print_line("rendering_driver " + rendering_driver);
- if (rendering_driver == "GLES2") {
+ if (rendering_driver == "opengl") {
if (getenv("DRI_PRIME") == nullptr) {
int use_prime = -1;
@@ -4182,7 +4178,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
}
- GLManager_X11::ContextType opengl_api_type = GLManager_X11::GLES_2_0_COMPATIBLE;
+ GLManager_X11::ContextType opengl_api_type = GLManager_X11::GLES_3_0_COMPATIBLE;
gl_manager = memnew(GLManager_X11(p_resolution, opengl_api_type));
@@ -4197,9 +4193,9 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
// gl_manager->set_use_vsync(current_videomode.use_vsync);
if (true) {
- // if (RasterizerGLES2::is_viable() == OK) {
- // RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
+ // if (RasterizerOpenGL::is_viable() == OK) {
+ // RasterizerOpenGL::register_config();
+ RasterizerOpenGL::make_current();
} else {
memdelete(gl_manager);
gl_manager = nullptr;
@@ -4415,9 +4411,9 @@ DisplayServerX11::~DisplayServerX11() {
context_vulkan->window_destroy(E.key);
}
#endif
-#ifdef GLES_X11_ENABLED
- if (rendering_driver == "GLES2") {
- gl_manager->window_destroy(E->key());
+#ifdef OPENGL_ENABLED
+ if (rendering_driver == "opengl") {
+ gl_manager->window_destroy(E.key);
}
#endif
@@ -4444,7 +4440,7 @@ DisplayServerX11::~DisplayServerX11() {
}
#endif
-#ifdef GLES_X11_ENABLED
+#ifdef OPENGL_ENABLED
if (gl_manager) {
memdelete(gl_manager);
gl_manager = nullptr;
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index bbf0e64fd3..ba25829974 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -31,7 +31,7 @@
#ifndef DISPLAY_SERVER_X11_H
#define DISPLAY_SERVER_X11_H
-#include "drivers/gles_common/rasterizer_platforms.h"
+#include "drivers/opengl/rasterizer_platforms.h"
#ifdef X11_ENABLED
@@ -48,7 +48,7 @@
#include "servers/rendering/renderer_compositor.h"
#include "servers/rendering_server.h"
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
#include "gl_manager_x11.h"
#endif
@@ -101,7 +101,7 @@ class DisplayServerX11 : public DisplayServer {
Atom requested;
int xdnd_version;
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
GLManager_X11 *gl_manager = nullptr;
#endif
#if defined(VULKAN_ENABLED)
@@ -339,7 +339,7 @@ public:
virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual void gl_window_make_current(DisplayServer::WindowID p_window_id);
+ virtual void gl_window_make_current(DisplayServer::WindowID p_window_id) override;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
diff --git a/platform/linuxbsd/gl_manager_x11.cpp b/platform/linuxbsd/gl_manager_x11.cpp
index e3d12dcb01..5928ff3147 100644
--- a/platform/linuxbsd/gl_manager_x11.cpp
+++ b/platform/linuxbsd/gl_manager_x11.cpp
@@ -31,7 +31,7 @@
#include "gl_manager_x11.h"
#ifdef X11_ENABLED
-#if defined(GLES_X11_ENABLED)
+#if defined(OPENGL_ENABLED)
#include <stdio.h>
#include <stdlib.h>
@@ -174,9 +174,19 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&ctxErrorHandler);
switch (context_type) {
- case GLES_2_0_COMPATIBLE: {
- gl_display.context->glx_context = glXCreateNewContext(gl_display.x11_display, fbconfig, GLX_RGBA_TYPE, 0, true);
- ERR_FAIL_COND_V(!gl_display.context->glx_context, ERR_UNCONFIGURED);
+ case GLES_3_0_COMPATIBLE: {
+ // FIXME: Use `GLX_CONTEXT_CORE_PROFILE_BIT_ARB` instead of compatibility profile
+ // once deprecated API usages are fixed.
+ static int context_attribs[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 3,
+ GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+ GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /*|GLX_CONTEXT_DEBUG_BIT_ARB*/,
+ None
+ };
+
+ gl_display.context->glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, nullptr, true, context_attribs);
+ ERR_FAIL_COND_V(ctxErrorOccurred || !gl_display.context->glx_context, ERR_UNCONFIGURED);
} break;
}
diff --git a/platform/linuxbsd/gl_manager_x11.h b/platform/linuxbsd/gl_manager_x11.h
index 6781312074..e2e2545f3e 100644
--- a/platform/linuxbsd/gl_manager_x11.h
+++ b/platform/linuxbsd/gl_manager_x11.h
@@ -28,13 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#pragma once
+#ifndef GL_MANAGER_X11_H
+#define GL_MANAGER_X11_H
#ifdef X11_ENABLED
-#include "drivers/gles_common/rasterizer_platforms.h"
+#include "drivers/opengl/rasterizer_platforms.h"
-#if defined(GLES_X11_ENABLED)
+#ifdef OPENGL_ENABLED
#include "core/os/os.h"
#include "core/templates/local_vector.h"
@@ -47,7 +48,7 @@ struct GLManager_X11_Private;
class GLManager_X11 {
public:
enum ContextType {
- GLES_2_0_COMPATIBLE,
+ GLES_3_0_COMPATIBLE,
};
private:
@@ -123,5 +124,7 @@ public:
~GLManager_X11();
};
-#endif // GLES_X11_ENABLED
+#endif // OPENGL_ENABLED
#endif // X11_ENABLED
+
+#endif // GL_MANAGER_X11_H
diff --git a/platform/linuxbsd/platform_config.h b/platform/linuxbsd/platform_config.h
index cdf989fee7..aa78b48bb0 100644
--- a/platform/linuxbsd/platform_config.h
+++ b/platform/linuxbsd/platform_config.h
@@ -44,5 +44,4 @@
#endif
#endif
-#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
-#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
+#define OPENGL_INCLUDE_H "thirdparty/glad/glad/glad.h"