diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index 4b63bb0cc3..1cbef2af3d 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -3412,6 +3412,14 @@
- macOS: [code]EGLConfig[/code] for the window (ANGLE).
- Linux (Wayland): [code]EGLConfig[/code] for the window.
+
+ The GLX [code]VisualID[/code] for the window.
+ [b]Note:[/b] Only available on Linux when using X11.
+
+
+ The [code]GLXFBConfig[/code] for the window.
+ [b]Note:[/b] Only available on Linux when using X11.
+
Utterance has begun to be spoken.
diff --git a/modules/openxr/extensions/platform/openxr_opengl_extension.cpp b/modules/openxr/extensions/platform/openxr_opengl_extension.cpp
index 3b3da1eb06..c7ee189818 100644
--- a/modules/openxr/extensions/platform/openxr_opengl_extension.cpp
+++ b/modules/openxr/extensions/platform/openxr_opengl_extension.cpp
@@ -191,14 +191,14 @@ void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_nex
void *display_handle = (void *)display_server->window_get_native_handle(DisplayServer::DISPLAY_HANDLE);
void *glxcontext_handle = (void *)display_server->window_get_native_handle(DisplayServer::OPENGL_CONTEXT);
void *glxdrawable_handle = (void *)display_server->window_get_native_handle(DisplayServer::WINDOW_HANDLE);
+ void *glx_fbconfig_handle = (void *)display_server->window_get_native_handle(DisplayServer::GLX_FBCONFIG);
+ VisualID glx_visualid = (VisualID)display_server->window_get_native_handle(DisplayServer::GLX_VISUALID);
graphics_binding_gl.xDisplay = (Display *)display_handle;
graphics_binding_gl.glxContext = (GLXContext)glxcontext_handle;
graphics_binding_gl.glxDrawable = (GLXDrawable)glxdrawable_handle;
-
- // spec says to use proper values but runtimes don't care
- graphics_binding_gl.visualid = 0;
- graphics_binding_gl.glxFBConfig = nullptr;
+ graphics_binding_gl.glxFBConfig = (GLXFBConfig)glx_fbconfig_handle;
+ graphics_binding_gl.visualid = glx_visualid;
#endif
#endif
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 19a65e3a13..f5d55df826 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2149,6 +2149,18 @@ int64_t DisplayServerX11::window_get_native_handle(HandleType p_handle_type, Win
}
return 0;
}
+ case GLX_VISUALID: {
+ if (gl_manager) {
+ return (int64_t)gl_manager->get_glx_visualid(p_window);
+ }
+ return 0;
+ }
+ case GLX_FBCONFIG: {
+ if (gl_manager) {
+ return (int64_t)gl_manager->get_glx_fbconfig(p_window);
+ }
+ return 0;
+ }
#endif
default: {
return 0;
diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp
index 151730b9a2..cbcce3c73a 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.cpp
+++ b/platform/linuxbsd/x11/gl_manager_x11.cpp
@@ -195,6 +195,7 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
// for later creating windows using this display
if (vi) {
gl_display.x_vi = *vi;
+ gl_display.x_fbconfig = fbconfig;
}
XFree(vi);
@@ -382,6 +383,28 @@ void *GLManager_X11::get_glx_context(DisplayServer::WindowID p_window_id) {
return (void *)disp.context->glx_context;
}
+VisualID GLManager_X11::get_glx_visualid(DisplayServer::WindowID p_window_id) {
+ if (p_window_id == -1) {
+ return (VisualID)0;
+ }
+
+ const GLWindow &win = _windows[p_window_id];
+ const GLDisplay &disp = get_display(win.gldisplay_id);
+
+ return disp.x_vi.visualid;
+}
+
+void *GLManager_X11::get_glx_fbconfig(DisplayServer::WindowID p_window_id) {
+ if (p_window_id == -1) {
+ return nullptr;
+ }
+
+ const GLWindow &win = _windows[p_window_id];
+ const GLDisplay &disp = get_display(win.gldisplay_id);
+
+ return disp.x_fbconfig;
+}
+
GLManager_X11::GLManager_X11(const Vector2i &p_size, ContextType p_context_type) {
context_type = p_context_type;
diff --git a/platform/linuxbsd/x11/gl_manager_x11.h b/platform/linuxbsd/x11/gl_manager_x11.h
index 3bd956b232..01598a38ca 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.h
+++ b/platform/linuxbsd/x11/gl_manager_x11.h
@@ -78,6 +78,7 @@ private:
GLManager_X11_Private *context = nullptr;
::Display *x11_display = nullptr;
XVisualInfo x_vi = {};
+ void *x_fbconfig = nullptr;
};
// just for convenience, window and display struct
@@ -126,6 +127,8 @@ public:
bool is_using_vsync() const;
void *get_glx_context(DisplayServer::WindowID p_window_id);
+ void *get_glx_fbconfig(DisplayServer::WindowID p_window_id);
+ VisualID get_glx_visualid(DisplayServer::WindowID p_window_id);
Error open_display(Display *p_display);
GLManager_X11(const Vector2i &p_size, ContextType p_context_type);
diff --git a/servers/display/display_server.cpp b/servers/display/display_server.cpp
index 85152425f9..e310a8f918 100644
--- a/servers/display/display_server.cpp
+++ b/servers/display/display_server.cpp
@@ -1952,6 +1952,8 @@ void DisplayServer::_bind_methods() {
BIND_ENUM_CONSTANT(OPENGL_CONTEXT);
BIND_ENUM_CONSTANT(EGL_DISPLAY);
BIND_ENUM_CONSTANT(EGL_CONFIG);
+ BIND_ENUM_CONSTANT(GLX_VISUALID);
+ BIND_ENUM_CONSTANT(GLX_FBCONFIG);
BIND_ENUM_CONSTANT(TTS_UTTERANCE_STARTED);
BIND_ENUM_CONSTANT(TTS_UTTERANCE_ENDED);
diff --git a/servers/display/display_server.h b/servers/display/display_server.h
index 9ecbd61c97..2365e88905 100644
--- a/servers/display/display_server.h
+++ b/servers/display/display_server.h
@@ -100,6 +100,8 @@ public:
OPENGL_CONTEXT,
EGL_DISPLAY,
EGL_CONFIG,
+ GLX_VISUALID,
+ GLX_FBCONFIG,
};
enum Context {