mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
render/gles2: make EGL context current in bind_buffer
Instead of requiring callers to manually make the EGL context current before binding a buffer and unsetting it after unbinding a buffer, do it inside wlr_renderer_bind_buffer. This hides renderer-specific implementation details inside the wlr_renderer interface. Non-GLES2 renderers may not use EGL. This removes all EGL dependencies from the backends. References: https://github.com/swaywm/wlroots/issues/2618 References: https://github.com/swaywm/wlroots/pull/2615#issuecomment-756687006
This commit is contained in:
parent
08a4c62aac
commit
afdf4dc890
5 changed files with 6 additions and 55 deletions
|
|
@ -13,8 +13,6 @@
|
|||
#include <wlr/interfaces/wlr_output.h>
|
||||
#include <wlr/interfaces/wlr_pointer.h>
|
||||
#include <wlr/interfaces/wlr_touch.h>
|
||||
#include <wlr/render/egl.h>
|
||||
#include <wlr/render/gles2.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
||||
#include "backend/x11.h"
|
||||
|
|
@ -99,7 +97,6 @@ static bool output_attach_render(struct wlr_output *wlr_output,
|
|||
int *buffer_age) {
|
||||
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
||||
struct wlr_x11_backend *x11 = output->x11;
|
||||
struct wlr_egl *egl = wlr_gles2_renderer_get_egl(x11->renderer);
|
||||
|
||||
wlr_buffer_unlock(output->back_buffer);
|
||||
output->back_buffer = wlr_swapchain_acquire(output->swapchain, buffer_age);
|
||||
|
|
@ -107,9 +104,6 @@ static bool output_attach_render(struct wlr_output *wlr_output,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!wlr_egl_make_current(egl)) {
|
||||
return false;
|
||||
}
|
||||
if (!wlr_renderer_bind_buffer(x11->renderer, output->back_buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -207,12 +201,10 @@ static struct wlr_x11_buffer *get_or_create_x11_buffer(
|
|||
|
||||
static bool output_commit_buffer(struct wlr_x11_output *output) {
|
||||
struct wlr_x11_backend *x11 = output->x11;
|
||||
struct wlr_egl *egl = wlr_gles2_renderer_get_egl(x11->renderer);
|
||||
|
||||
assert(output->back_buffer != NULL);
|
||||
|
||||
wlr_renderer_bind_buffer(x11->renderer, NULL);
|
||||
wlr_egl_unset_current(egl);
|
||||
|
||||
struct wlr_x11_buffer *x11_buffer =
|
||||
get_or_create_x11_buffer(output, output->back_buffer);
|
||||
|
|
@ -319,10 +311,8 @@ static bool output_commit(struct wlr_output *wlr_output) {
|
|||
static void output_rollback_render(struct wlr_output *wlr_output) {
|
||||
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
|
||||
struct wlr_x11_backend *x11 = output->x11;
|
||||
struct wlr_egl *egl = wlr_gles2_renderer_get_egl(x11->renderer);
|
||||
|
||||
wlr_renderer_bind_buffer(x11->renderer, NULL);
|
||||
wlr_egl_unset_current(egl);
|
||||
}
|
||||
|
||||
static const struct wlr_output_impl output_impl = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue