From fa7f1bdaa94133442b61a1c278e530400a5e9046 Mon Sep 17 00:00:00 2001 From: Roz K Date: Fri, 16 Dec 2022 03:21:10 +0100 Subject: [PATCH] Remove sRGB framebuffer config filtering and add some debug output. --- cpp/opengl/render_context_glx.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cpp/opengl/render_context_glx.cpp b/cpp/opengl/render_context_glx.cpp index 3a85ac1..c8f8c73 100644 --- a/cpp/opengl/render_context_glx.cpp +++ b/cpp/opengl/render_context_glx.cpp @@ -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);