diff options
Diffstat (limited to 'render/gles2')
-rw-r--r-- | render/gles2/renderer.c | 6 | ||||
-rw-r--r-- | render/gles2/texture.c | 34 |
2 files changed, 23 insertions, 17 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 8d197f42..e6ec881a 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -401,6 +401,8 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) { gles2_procs.glDebugMessageCallbackKHR(NULL, NULL); } + wlr_egl_unset_current(renderer->egl); + free(renderer); } @@ -670,6 +672,8 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { POP_GLES2_DEBUG; + wlr_egl_unset_current(renderer->egl); + return &renderer->wlr_renderer; error: @@ -686,6 +690,8 @@ error: gles2_procs.glDebugMessageCallbackKHR(NULL, NULL); } + wlr_egl_unset_current(renderer->egl); + free(renderer); return NULL; } diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 32efb03f..64a0d9f1 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -29,9 +29,7 @@ struct wlr_gles2_texture *gles2_get_texture( static struct wlr_gles2_texture *get_gles2_texture_in_context( struct wlr_texture *wlr_texture) { struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); - if (!wlr_egl_is_current(texture->egl)) { - wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL); - } + wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL); return texture; } @@ -49,6 +47,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture, if (texture->target != GL_TEXTURE_2D) { wlr_log(WLR_ERROR, "Cannot write pixels to immutable texture"); + wlr_egl_unset_current(texture->egl); return false; } @@ -75,6 +74,8 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture, glBindTexture(GL_TEXTURE_2D, 0); POP_GLES2_DEBUG; + + wlr_egl_unset_current(texture->egl); return true; } @@ -111,11 +112,8 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) { return; } - struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); - - if (!wlr_egl_is_current(texture->egl)) { - wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL); - } + struct wlr_gles2_texture *texture = + get_gles2_texture_in_context(wlr_texture); PUSH_GLES2_DEBUG; @@ -124,6 +122,8 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) { POP_GLES2_DEBUG; + wlr_egl_unset_current(texture->egl); + free(texture); } @@ -137,9 +137,7 @@ static const struct wlr_texture_impl texture_impl = { struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl, enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height, const void *data) { - if (!wlr_egl_is_current(egl)) { - wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); - } + wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); if (fmt == NULL) { @@ -172,14 +170,14 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl, glBindTexture(GL_TEXTURE_2D, 0); POP_GLES2_DEBUG; + + wlr_egl_unset_current(egl); return &texture->wlr_texture; } struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl, struct wl_resource *resource) { - if (!wlr_egl_is_current(egl)) { - wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); - } + wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); if (!gles2_procs.glEGLImageTargetTexture2DOES) { return NULL; @@ -235,14 +233,14 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl, glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0); POP_GLES2_DEBUG; + + wlr_egl_unset_current(egl); return &texture->wlr_texture; } struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl, struct wlr_dmabuf_attributes *attribs) { - if (!wlr_egl_is_current(egl)) { - wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); - } + wlr_egl_make_current(egl, EGL_NO_SURFACE, NULL); if (!gles2_procs.glEGLImageTargetTexture2DOES) { return NULL; @@ -297,6 +295,8 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl, glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0); POP_GLES2_DEBUG; + + wlr_egl_unset_current(egl); return &texture->wlr_texture; } |