diff options
author | emersion <contact@emersion.fr> | 2018-11-04 09:23:57 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-11-10 13:20:54 +0100 |
commit | 09550032b7e897755be30c6339f97489b07570ff (patch) | |
tree | 23076b31c8760cda651fdce364376f757afbc2b3 /render/wlr_renderer.c | |
parent | ca570fa63cb187ba078d95e0973da8562687673f (diff) |
render: correctly set EGL_RENDERABLE_TYPE
This should be set to EGL_OPENGL_ES2_BIT.
Also fixes EGL config attributes in the headless and X11 backends.
Diffstat (limited to 'render/wlr_renderer.c')
-rw-r--r-- | render/wlr_renderer.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 10dc6db2..ca1a337d 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -198,7 +198,30 @@ void wlr_renderer_init_wl_display(struct wlr_renderer *r, struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl, EGLenum platform, void *remote_display, EGLint *config_attribs, EGLint visual_id) { - if (!wlr_egl_init(egl, platform, remote_display, config_attribs, visual_id)) { + // Append GLES2-specific bits to the provided EGL config attributes + EGLint gles2_config_attribs[] = { + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NONE, + }; + + size_t config_attribs_len = 0; // not including terminating EGL_NONE + while (config_attribs != NULL && + config_attribs[config_attribs_len] != EGL_NONE) { + ++config_attribs_len; + } + + size_t all_config_attribs_len = config_attribs_len + + sizeof(gles2_config_attribs) / sizeof(gles2_config_attribs[0]); + EGLint all_config_attribs[all_config_attribs_len]; + if (config_attribs_len > 0) { + memcpy(all_config_attribs, config_attribs, + config_attribs_len * sizeof(EGLint)); + } + 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, + visual_id)) { wlr_log(WLR_ERROR, "Could not initialize EGL"); return NULL; } |