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;
|
||||
GLXFBConfig * const fbc = glXChooseFBConfig(rk_display, DefaultScreen(rk_display), rk_visual_attribs, &fbcount);
|
||||
if (!fbc) {
|
||||
rk_printf("Failed to retrieve a framebuffer config.");
|
||||
rk_printf("Failed to retrieve framebuffer configs.");
|
||||
rk_destroy_context();
|
||||
return nullptr;
|
||||
}
|
||||
printf("[GLX] Found %d framebuffer configs.\n", fbcount);
|
||||
|
||||
int best_fbc = -1;
|
||||
int best_num_samp = -1;
|
||||
for (int i = 0; i < fbcount; ++i) {
|
||||
XVisualInfo * vi = glXGetVisualFromFBConfig(rk_display, fbc[i]);
|
||||
if (vi) {
|
||||
int srgb = 0;
|
||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgb);
|
||||
if (srgb) {
|
||||
int samp_buf, samples;
|
||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLE_BUFFERS, &samp_buf);
|
||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLES, &samples);
|
||||
if (best_fbc < 0 || (samp_buf && samples > best_num_samp)) {
|
||||
best_fbc = i;
|
||||
best_num_samp = samples;
|
||||
}
|
||||
int samp_buf, samples;
|
||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLE_BUFFERS, &samp_buf);
|
||||
glXGetFBConfigAttrib(rk_display, fbc[i], GLX_SAMPLES, &samples);
|
||||
if (best_fbc < 0 || (samp_buf && samples > best_num_samp)) {
|
||||
best_fbc = i;
|
||||
best_num_samp = samples;
|
||||
}
|
||||
XFree(vi);
|
||||
}
|
||||
}
|
||||
if (best_fbc == -1) {
|
||||
XFree(fbc);
|
||||
rk_printf("Failed to find sRGB framebuffer.");
|
||||
rk_printf("Failed to find a suitable framebuffer config.");
|
||||
rk_destroy_context();
|
||||
return nullptr;
|
||||
}
|
||||
GLXFBConfig const bestFbc = fbc[best_fbc];
|
||||
XFree(fbc);
|
||||
printf("[GLX] Select framebuffer config with %d samples.\n", best_num_samp);
|
||||
|
||||
XVisualInfo * const vi = glXGetVisualFromFBConfig(rk_display, bestFbc);
|
||||
rk_colormap = XCreateColormap(rk_display, RootWindow(rk_display, vi->screen), vi->visual, AllocNone);
|
||||
|
Loading…
Reference in New Issue
Block a user