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

@ -108,9 +108,11 @@ struct wlr_gles2_buffer {
struct wl_list link; // wlr_gles2_renderer.buffers
bool external_only;
EGLImageKHR image;
GLuint rbo;
GLuint fbo;
int n_images;
EGLImageKHR image[4];
GLuint rbo[4];
GLuint fbo[4];
GLuint tex;
struct wlr_addon addon;
@ -153,7 +155,7 @@ const struct wlr_gles2_pixel_format *get_gles2_format_from_gl(
void get_gles2_shm_formats(const struct wlr_gles2_renderer *renderer,
struct wlr_drm_format_set *out);
GLuint gles2_buffer_get_fbo(struct wlr_gles2_buffer *buffer);
GLuint gles2_buffer_get_fbo(struct wlr_gles2_buffer *buffer, int index);
struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_renderer *wlr_renderer);