mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-08 13:29:45 -05:00
render/egl: make wlr_egl context private, replace them with public wlr_egl_context functions
This commit is contained in:
parent
6eff6c365b
commit
f70f37a2c2
3 changed files with 42 additions and 4 deletions
22
render/egl.c
22
render/egl.c
|
|
@ -560,6 +560,27 @@ bool wlr_egl_is_current(struct wlr_egl *egl) {
|
|||
return eglGetCurrentContext() == egl->context;
|
||||
}
|
||||
|
||||
bool wlr_egl_context_set_current(struct wlr_egl_context *ctx) {
|
||||
if (!eglMakeCurrent(ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
ctx->context)) {
|
||||
wlr_log(WLR_ERROR, "eglMakeCurrent failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wlr_egl_context_unset_current(struct wlr_egl_context *ctx) {
|
||||
if (!eglMakeCurrent(ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT)) {
|
||||
wlr_log(WLR_ERROR, "eglMakeCurrent failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wlr_egl_context_is_current(struct wlr_egl_context *ctx) {
|
||||
return eglGetCurrentContext() == ctx->context;
|
||||
}
|
||||
|
||||
void wlr_egl_context_save(struct wlr_egl_context *context) {
|
||||
context->display = eglGetCurrentDisplay();
|
||||
|
|
@ -568,7 +589,6 @@ void wlr_egl_context_save(struct wlr_egl_context *context) {
|
|||
context->read_surface = eglGetCurrentSurface(EGL_READ);
|
||||
}
|
||||
|
||||
|
||||
bool wlr_egl_context_restore(struct wlr_egl_context *context) {
|
||||
// If the saved context is a null-context, we must use the current
|
||||
// display instead of the saved display because eglMakeCurrent() can't
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue