mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -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
|
|
@ -139,10 +139,11 @@ error_buffer:
|
|||
|
||||
static bool gles2_bind_buffer(struct wlr_renderer *wlr_renderer,
|
||||
struct wlr_buffer *wlr_buffer) {
|
||||
struct wlr_gles2_renderer *renderer =
|
||||
gles2_get_renderer_in_context(wlr_renderer);
|
||||
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
||||
|
||||
if (renderer->current_buffer != NULL) {
|
||||
assert(wlr_egl_is_current(renderer->egl));
|
||||
|
||||
push_gles2_debug(renderer);
|
||||
glFlush();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
|
@ -153,9 +154,12 @@ static bool gles2_bind_buffer(struct wlr_renderer *wlr_renderer,
|
|||
}
|
||||
|
||||
if (wlr_buffer == NULL) {
|
||||
wlr_egl_unset_current(renderer->egl);
|
||||
return true;
|
||||
}
|
||||
|
||||
wlr_egl_make_current(renderer->egl);
|
||||
|
||||
struct wlr_gles2_buffer *buffer = get_buffer(renderer, wlr_buffer);
|
||||
if (buffer == NULL) {
|
||||
buffer = create_buffer(renderer, wlr_buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue