1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Load X11 dynamically

The loaders have been generated through hpvb's dynload-wrapper, although
they had to be heavily handpatched to workaround some already reported
issues with it. I added a note to each generated file to account for
that.

As GLAD uses X11 stuff directly, I had to define the GLAD_GLX_NO_X11
macro to not let do it that, and handle myself the display loading and
screen handling part myself, which wasn't that hard but it's still
something worth saying.

I plan to improve greatly the X11 backend (including this aspect) but,
as the release isn't that far and I'm also working on the Wayland
backend, this will do for now, I hope.
This commit is contained in:
Riteo
2022-11-29 12:03:06 +01:00
parent daf168f4c8
commit 2dd5a792bb
21 changed files with 12818 additions and 28 deletions

View File

@@ -41,8 +41,7 @@
#include "thirdparty/glad/glad/gl.h"
#include "thirdparty/glad/glad/glx.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "dynwrappers/xlib-so_wrap.h"
#include <cstring>
@@ -89,6 +88,10 @@ void create_context() {
None
};
if (gladLoaderLoadGLX(x11_display, XScreenNumberOfScreen(XDefaultScreenOfDisplay(x11_display))) == 0) {
print_verbose("Unable to load GLX, GPU detection skipped.");
quick_exit(1);
}
int fbcount;
GLXFBConfig fbconfig = nullptr;
XVisualInfo *vi = nullptr;
@@ -189,11 +192,6 @@ int detect_prime() {
setenv("DRI_PRIME", "1", 1);
}
if (gladLoaderLoadGLX(NULL, 0) == 0) {
print_verbose("Unable to load GLX, GPU detection skipped.");
quick_exit(1);
}
create_context();
PFNGLGETSTRINGPROC glGetString = (PFNGLGETSTRINGPROC)glXGetProcAddressARB((GLubyte *)"glGetString");