Merge pull request #116256 from dsnopek/monado-opengl-fix
OpenXR: Fix OpenGL initialization with Monado on X11
This commit is contained in:
commit
4106b5cdcc
7 changed files with 54 additions and 4 deletions
|
|
@ -3412,6 +3412,14 @@
|
|||
- macOS: [code]EGLConfig[/code] for the window (ANGLE).
|
||||
- Linux (Wayland): [code]EGLConfig[/code] for the window.
|
||||
</constant>
|
||||
<constant name="GLX_VISUALID" value="6" enum="HandleType">
|
||||
The GLX [code]VisualID[/code] for the window.
|
||||
[b]Note:[/b] Only available on Linux when using X11.
|
||||
</constant>
|
||||
<constant name="GLX_FBCONFIG" value="7" enum="HandleType">
|
||||
The [code]GLXFBConfig[/code] for the window.
|
||||
[b]Note:[/b] Only available on Linux when using X11.
|
||||
</constant>
|
||||
<constant name="TTS_UTTERANCE_STARTED" value="0" enum="TTSUtteranceEvent">
|
||||
Utterance has begun to be spoken.
|
||||
</constant>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ public:
|
|||
OPENGL_CONTEXT,
|
||||
EGL_DISPLAY,
|
||||
EGL_CONFIG,
|
||||
GLX_VISUALID,
|
||||
GLX_FBCONFIG,
|
||||
};
|
||||
|
||||
enum Context {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue