Skip to content

Commit

Permalink
backend/egl: refactor eglChooseConfig's attrib_list
Browse files Browse the repository at this point in the history
* the default value of EGL_SURFACE_TYPE is EGL_WINDOW_BIT so let's
remove it;
* since we're not using the stencil buffer let's set the
EGL_STENCIL_SIZE attribute to 0 to match the glXChooseFBConfig's
attrib_list and avoid getting frame buffer configurations with stencil
buffer;
* the default value of EGL_STENCIL_SIZE is 0 so let's remove it;
* since attributes are described in the alphabetical order in the
eglChooseConfig function specification, which is not very practical,
let's mimic the order they're sorted in in glXChooseFBConfig's
attrib_list.

references:
https://registry.khronos.org/EGL/sdk/docs/man/html/eglChooseConfig.xhtml
  • Loading branch information
absolutelynothelix committed Jul 29, 2024
1 parent 72dc6b4 commit 3c7a67d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/backend/gl/egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,13 @@ static backend_t *egl_init(session_t *ps, xcb_window_t target) {
// clang-format off
if (eglChooseConfig(gd->display,
(EGLint[]){
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_RED_SIZE, visual_info.red_size,
EGL_GREEN_SIZE, visual_info.green_size,
EGL_BLUE_SIZE, visual_info.blue_size,
EGL_ALPHA_SIZE, visual_info.alpha_size,
EGL_STENCIL_SIZE, 1,
EGL_CONFIG_CAVEAT, EGL_NONE,
EGL_NONE,
EGL_RED_SIZE, visual_info.red_size,
EGL_GREEN_SIZE, visual_info.green_size,
EGL_BLUE_SIZE, visual_info.blue_size,
EGL_ALPHA_SIZE, visual_info.alpha_size,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_CONFIG_CAVEAT, EGL_NONE,
EGL_NONE,
}, &config, nconfigs, &nconfigs) != EGL_TRUE) {
log_error("Failed to choose EGL config for the root window.");
goto end;
Expand Down

0 comments on commit 3c7a67d

Please sign in to comment.