mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
render/egl: support config-less wlr_egl
When using wlr_swapchain, there's no need to select an EGLConfig. Add support for creating config-less EGL contexts.
This commit is contained in:
parent
44b1ff16e9
commit
037710b1d4
2 changed files with 18 additions and 4 deletions
16
render/egl.c
16
render/egl.c
|
@ -319,9 +319,19 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
|||
check_egl_ext(device_exts_str, "EGL_EXT_device_drm");
|
||||
}
|
||||
|
||||
if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) {
|
||||
wlr_log(WLR_ERROR, "Failed to get EGL config");
|
||||
goto error;
|
||||
if (config_attribs != NULL) {
|
||||
if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) {
|
||||
wlr_log(WLR_ERROR, "Failed to get EGL config");
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
if (!check_egl_ext(display_exts_str, "EGL_KHR_no_config_context") &&
|
||||
!check_egl_ext(display_exts_str, "EGL_MESA_configless_context")) {
|
||||
wlr_log(WLR_ERROR, "EGL_KHR_no_config_context or "
|
||||
"EGL_MESA_configless_context not supported");
|
||||
goto error;
|
||||
}
|
||||
egl->config = EGL_NO_CONFIG_KHR;
|
||||
}
|
||||
|
||||
wlr_log(WLR_INFO, "Using EGL %d.%d", (int)major, (int)minor);
|
||||
|
|
|
@ -268,7 +268,11 @@ struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl,
|
|||
memcpy(&all_config_attribs[config_attribs_len], gles2_config_attribs,
|
||||
sizeof(gles2_config_attribs));
|
||||
|
||||
if (!wlr_egl_init(egl, platform, remote_display, all_config_attribs,
|
||||
if (config_attribs != NULL) {
|
||||
config_attribs = all_config_attribs;
|
||||
}
|
||||
|
||||
if (!wlr_egl_init(egl, platform, remote_display, config_attribs,
|
||||
visual_id)) {
|
||||
wlr_log(WLR_ERROR, "Could not initialize EGL");
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue