Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

render: better integrate bind_buffer with begin/end #2618

Closed
emersion opened this issue Jan 8, 2021 · 0 comments · Fixed by #2950
Closed

render: better integrate bind_buffer with begin/end #2618

emersion opened this issue Jan 8, 2021 · 0 comments · Fixed by #2950

Comments

@emersion
Copy link
Member

emersion commented Jan 8, 2021

Right now, one needs to do the following to render:

wlr_egl_make_current(egl, EGL_NO_SURFACE); // done in the backend
wlr_renderer_bind_buffer(renderer, buffer); // done in the backend
wlr_renderer_begin(renderer, width, height); // done in the compositor

// Perform the rendering operations

wlr_renderer_end(renderer); // done in the compositor
wlr_renderer_bind_buffer(renderer, NULL); // done in the backend
wlr_egl_unset_current(egl); // done in the backend

Once #2615 (comment) is done, this could be simplified to:

wlr_renderer_bind_buffer(renderer, buffer);
wlr_renderer_begin(renderer, width, height);

// Perform the rendering operations

wlr_renderer_end(renderer);
wlr_renderer_bind_buffer(renderer, NULL);

I'm still not very happy with the API, something like this would be better:

wlr_renderer_begin(renderer, buffer);

// Perform the rendering operations

wlr_renderer_end(renderer);

However this would be a breaking change, because compositors call wlr_renderer_begin. Also need to figure out if/how compositors should acquire the buffer.

emersion added a commit to emersion/wlroots that referenced this issue Jan 14, 2021
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 almost all EGL dependencies from the backends, the only
remaining one is wlr_renderer_autocreate args.

References: swaywm#2618
References: swaywm#2615 (comment)
emersion added a commit to emersion/wlroots that referenced this issue Jan 16, 2021
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 almost all EGL dependencies from the backends, the only
remaining one is wlr_renderer_autocreate args.

References: swaywm#2618
References: swaywm#2615 (comment)
emersion added a commit to emersion/wlroots that referenced this issue Jan 16, 2021
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: swaywm#2618
References: swaywm#2615 (comment)
emersion added a commit that referenced this issue Jan 16, 2021
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: #2618
References: #2615 (comment)
emersion added a commit to emersion/wlroots that referenced this issue Jun 1, 2021
This allows compositors to choose a wlr_buffer to render to. This
is a less awkward interface than having to call bind_buffer() before
and after begin() and end().

Closes: swaywm#2618
emersion added a commit to emersion/wlroots that referenced this issue Jun 1, 2021
This allows compositors to choose a wlr_buffer to render to. This
is a less awkward interface than having to call bind_buffer() before
and after begin() and end().

Closes: swaywm#2618
bl4ckb0ne pushed a commit that referenced this issue Jun 1, 2021
This allows compositors to choose a wlr_buffer to render to. This
is a less awkward interface than having to call bind_buffer() before
and after begin() and end().

Closes: #2618
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

1 participant