1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Fix multiwindow support in GLES3 for X11, Windows, and MacOS.

Instead of updating all viewports, then blitting all viewports
to the backbuffer, then swapping all buffers, we run through
all viewports and render, blit, and swap backbuffer before
going to the next viewport.
This commit is contained in:
clayjohn
2022-09-12 14:57:11 -07:00
parent 79b21e96ad
commit 96b7cb66df
6 changed files with 26 additions and 32 deletions

View File

@@ -256,7 +256,11 @@ void GLManager_X11::release_current() {
if (!_current_window) {
return;
}
glXMakeCurrent(_x_windisp.x11_display, None, nullptr);
if (!glXMakeCurrent(_x_windisp.x11_display, None, nullptr)) {
ERR_PRINT("glXMakeCurrent failed");
}
_current_window = nullptr;
}
void GLManager_X11::window_make_current(DisplayServer::WindowID p_window_id) {
@@ -276,7 +280,9 @@ void GLManager_X11::window_make_current(DisplayServer::WindowID p_window_id) {
const GLDisplay &disp = get_display(win.gldisplay_id);
glXMakeCurrent(disp.x11_display, win.x11_window, disp.context->glx_context);
if (!glXMakeCurrent(disp.x11_display, win.x11_window, disp.context->glx_context)) {
ERR_PRINT("glXMakeCurrent failed");
}
_internal_set_current_window(&win);
}
@@ -290,13 +296,12 @@ void GLManager_X11::make_current() {
return;
}
const GLDisplay &disp = get_current_display();
glXMakeCurrent(_x_windisp.x11_display, _x_windisp.x11_window, disp.context->glx_context);
if (!glXMakeCurrent(_x_windisp.x11_display, _x_windisp.x11_window, disp.context->glx_context)) {
ERR_PRINT("glXMakeCurrent failed");
}
}
void GLManager_X11::swap_buffers() {
// NO NEED TO CALL SWAP BUFFERS for each window...
// see https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXSwapBuffers.xml
if (!_current_window) {
return;
}
@@ -315,13 +320,6 @@ void GLManager_X11::swap_buffers() {
}
}
// print_line("\tswap_buffers");
// only for debugging without drawing anything
// glClearColor(Math::randf(), 0, 1, 1);
//glClear(GL_COLOR_BUFFER_BIT);
//const GLDisplay &disp = get_current_display();
glXSwapBuffers(_x_windisp.x11_display, _x_windisp.x11_window);
}