Remove sRGB framebuffer config filtering and add some debug output.
This commit is contained in:
parent
8f3612bed2
commit
fa7f1bdaa9
@ -109,38 +109,36 @@ rk_window_t rk_create_context(
|
|||||||
int fbcount;
|
int fbcount;
|
||||||
GLXFBConfig * const fbc = glXChooseFBConfig(rk_display, DefaultScreen(rk_display), rk_visual_attribs, &fbcount);
|
GLXFBConfig * const fbc = glXChooseFBConfig(rk_display, DefaultScreen(rk_display), rk_visual_attribs, &fbcount);
|
||||||
if (!fbc) {
|
if (!fbc) {
|
||||||
rk_printf("Failed to retrieve a framebuffer config.");
|
rk_printf("Failed to retrieve framebuffer configs.");
|
||||||
rk_destroy_context();
|
rk_destroy_context();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
printf("[GLX] Found %d framebuffer configs.\n", fbcount);
|
||||||
|
|
||||||
int best_fbc = -1;
|
int best_fbc = -1;
|
||||||
int best_num_samp = -1;
|
int best_num_samp = -1;
|
||||||
for (int i = 0; i < fbcount; ++i) {
|
for (int i = 0; i < fbcount; ++i) {
|
||||||
XVisualInfo * vi = glXGetVisualFromFBConfig(rk_display, fbc[i]);
|
XVisualInfo * vi = glXGetVisualFromFBConfig(rk_display, fbc[i]);
|
||||||
if (vi) {
|
if (vi) {
|
||||||
int srgb = 0;
|
int samp_buf, samples;
|
||||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgb);
|
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLE_BUFFERS, &samp_buf);
|
||||||
if (srgb) {
|
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLES, &samples);
|
||||||
int samp_buf, samples;
|
if (best_fbc < 0 || (samp_buf && samples > best_num_samp)) {
|
||||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLE_BUFFERS, &samp_buf);
|
best_fbc = i;
|
||||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLES, &samples);
|
best_num_samp = samples;
|
||||||
if (best_fbc < 0 || (samp_buf && samples > best_num_samp)) {
|
|
||||||
best_fbc = i;
|
|
||||||
best_num_samp = samples;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
XFree(vi);
|
XFree(vi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (best_fbc == -1) {
|
if (best_fbc == -1) {
|
||||||
XFree(fbc);
|
XFree(fbc);
|
||||||
rk_printf("Failed to find sRGB framebuffer.");
|
rk_printf("Failed to find a suitable framebuffer config.");
|
||||||
rk_destroy_context();
|
rk_destroy_context();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
GLXFBConfig const bestFbc = fbc[best_fbc];
|
GLXFBConfig const bestFbc = fbc[best_fbc];
|
||||||
XFree(fbc);
|
XFree(fbc);
|
||||||
|
printf("[GLX] Select framebuffer config with %d samples.\n", best_num_samp);
|
||||||
|
|
||||||
XVisualInfo * const vi = glXGetVisualFromFBConfig(rk_display, bestFbc);
|
XVisualInfo * const vi = glXGetVisualFromFBConfig(rk_display, bestFbc);
|
||||||
rk_colormap = XCreateColormap(rk_display, RootWindow(rk_display, vi->screen), vi->visual, AllocNone);
|
rk_colormap = XCreateColormap(rk_display, RootWindow(rk_display, vi->screen), vi->visual, AllocNone);
|
||||||
|
Loading…
Reference in New Issue
Block a user