Merge pull request #56039 from Rubonnek/update-detect-prime-formatting-master

This commit is contained in:
Rémi Verschelde 2021-12-20 10:28:16 +01:00 committed by GitHub
commit 51c5fa48ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -91,7 +91,7 @@ void create_context() {
};
int fbcount;
GLXFBConfig fbconfig = 0;
GLXFBConfig fbconfig = nullptr;
XVisualInfo *vi = nullptr;
XSetWindowAttributes swa;
@ -100,8 +100,9 @@ void create_context() {
unsigned long valuemask = CWBorderPixel | CWColormap | CWEventMask;
GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount);
if (!fbc)
if (!fbc) {
exit(1);
}
vi = glXGetVisualFromFBConfig(x11_display, fbc[0]);
@ -120,8 +121,9 @@ void create_context() {
swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, 10, 10, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa);
if (!x11_window)
if (!x11_window) {
exit(1);
}
glXMakeCurrent(x11_display, x11_window, glx_context);
XFree(vi);
@ -179,8 +181,9 @@ int detect_prime() {
close(fdset[0]);
if (i)
if (i) {
setenv("DRI_PRIME", "1", 1);
}
create_context();
const char *vendor = (const char *)glGetString(GL_VENDOR);