mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
renderer/gles2: Bail rendering to external buffers when binding them
We can't do it while we're creating them because we'll want to use gles2 buffers for textures soon.
This commit is contained in:
parent
0d9cd6932a
commit
484e248446
2 changed files with 7 additions and 7 deletions
|
@ -103,6 +103,7 @@ struct wlr_gles2_buffer {
|
|||
struct wlr_buffer *buffer;
|
||||
struct wlr_gles2_renderer *renderer;
|
||||
struct wl_list link; // wlr_gles2_renderer.buffers
|
||||
bool external_only;
|
||||
|
||||
EGLImageKHR image;
|
||||
GLuint rbo;
|
||||
|
|
|
@ -94,6 +94,11 @@ static const struct wlr_addon_interface buffer_addon_impl = {
|
|||
};
|
||||
|
||||
GLuint gles2_buffer_get_fbo(struct wlr_gles2_buffer *buffer) {
|
||||
if (buffer->external_only) {
|
||||
wlr_log(WLR_ERROR, "DMA-BUF format is external-only");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (buffer->fbo) {
|
||||
return buffer->fbo;
|
||||
}
|
||||
|
@ -148,18 +153,12 @@ static struct wlr_gles2_buffer *get_or_create_buffer(struct wlr_gles2_renderer *
|
|||
goto error_buffer;
|
||||
}
|
||||
|
||||
bool external_only;
|
||||
buffer->image = wlr_egl_create_image_from_dmabuf(renderer->egl,
|
||||
&dmabuf, &external_only);
|
||||
&dmabuf, &buffer->external_only);
|
||||
if (buffer->image == EGL_NO_IMAGE_KHR) {
|
||||
goto error_buffer;
|
||||
}
|
||||
|
||||
if (external_only) {
|
||||
wlr_log(WLR_ERROR, "DMA-BUF format is external-only");
|
||||
goto error_image;
|
||||
}
|
||||
|
||||
wlr_addon_init(&buffer->addon, &wlr_buffer->addons, renderer,
|
||||
&buffer_addon_impl);
|
||||
|
||||
|
|
Loading…
Reference in a new issue