From d5556ec78f65c286ae281a17d7b6b2ddc38c4c00 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 22 Feb 2024 19:26:06 +0100 Subject: render/egl: add save_context parameter to wlr_egl_make_current() Saving the old context and immediately making our own context current is a common pattern. Let's make it easier to do. No functional change, just refactoring. --- render/egl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'render/egl.c') diff --git a/render/egl.c b/render/egl.c index ac991295..e8b13ce8 100644 --- a/render/egl.c +++ b/render/egl.c @@ -649,7 +649,11 @@ bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImage image) { return egl->procs.eglDestroyImageKHR(egl->display, image); } -bool wlr_egl_make_current(struct wlr_egl *egl) { +bool wlr_egl_make_current(struct wlr_egl *egl, + struct wlr_egl_context *save_context) { + if (save_context != NULL) { + wlr_egl_save_context(save_context); + } if (!eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, egl->context)) { wlr_log(WLR_ERROR, "eglMakeCurrent failed"); -- cgit v1.2.3