render: gles2: Add NV12 GLES2 buffers

Rendering to NV12 buffers is not directly supported in GL ES2.0, but can
be implemented by rendering in 2 passes to 2 different EGL images.

This change makes provisions for multiple EGL images inside a
wlr_gles2_buffer and adds a special case for mapping NV12 buffers to
multiple EGL images.

Signed-off-by: Andri Yngvason <andri@yngvason.is>
This commit is contained in:
Andri Yngvason 2026-04-16 13:44:19 +00:00
parent 2283e05c30
commit c074f6e83f
4 changed files with 66 additions and 28 deletions

View file

@ -139,7 +139,7 @@ static bool gles2_texture_bind(struct wlr_gles2_texture *texture) {
return false;
}
GLuint fbo = gles2_buffer_get_fbo(texture->buffer);
GLuint fbo = gles2_buffer_get_fbo(texture->buffer, 0);
if (!fbo) {
return false;
}
@ -419,7 +419,7 @@ static struct wlr_texture *gles2_texture_from_dmabuf(
glBindTexture(texture->target, buffer->tex);
glTexParameteri(texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
renderer->procs.glEGLImageTargetTexture2DOES(texture->target, buffer->image);
renderer->procs.glEGLImageTargetTexture2DOES(texture->target, buffer->image[0]);
glBindTexture(texture->target, 0);
}