aboutsummaryrefslogtreecommitdiff
path: root/render/gles2/renderer.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-06-02 22:13:16 +0200
committerDrew DeVault <sir@cmpwn.com>2020-06-02 14:23:24 -0600
commite91417ea8dde8dcb694afc490ef37980d0a8e21a (patch)
treed4e8f811ad4bfae9d547d319422182fe1f6cb412 /render/gles2/renderer.c
parent019fe8bb7efcb52e936ffea1003329ad13d2f64d (diff)
render: stop making EGL context current in wlr_egl_init
This leaves an EGL context current behind. wlr_gles2_renderer_create was assuming the EGL context was already current because of this (because it called a GL function right off the bat).
Diffstat (limited to 'render/gles2/renderer.c')
-rw-r--r--render/gles2/renderer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index e6ec881a..59c970c3 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -558,6 +558,10 @@ extern const GLchar tex_fragment_src_rgbx[];
extern const GLchar tex_fragment_src_external[];
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
+ if (!wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL)) {
+ return NULL;
+ }
+
const char *exts_str = (const char *)glGetString(GL_EXTENSIONS);
if (exts_str == NULL) {
wlr_log(WLR_ERROR, "Failed to get GL_EXTENSIONS");
@@ -572,11 +576,6 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
wlr_renderer_init(&renderer->wlr_renderer, &renderer_impl);
renderer->egl = egl;
- if (!wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL)) {
- free(renderer);
- return NULL;
- }
-
renderer->exts_str = exts_str;
wlr_log(WLR_INFO, "Using %s", glGetString(GL_VERSION));