render: gles2: pass: Implement rendering into NV12 buffers

As mentioned in the previous commit message, we can't create an RBO out
of an NV12 buffer in GL ES2.0. Instead, we render in 2 passes to 2
separate RBOs.

This could be made more generic by having a lookup table for the
parameters that need to be set for each plane for any given format, but
as of yet, I see no practical reason for implementing any other kind of
YCbCr target buffer rendering as NV12 seems to be the only format that's
commonly supported by hardware video encoders.

Signed-off-by: Andri Yngvason <andri@yngvason.is>
This commit is contained in:
Andri Yngvason 2026-04-16 13:45:56 +00:00
parent c074f6e83f
commit 97c8d24fa4
3 changed files with 131 additions and 21 deletions

View file

@ -145,6 +145,8 @@ struct wlr_gles2_render_pass {
struct wlr_gles2_render_timer *timer;
struct wlr_drm_syncobj_timeline *signal_timeline;
uint64_t signal_point;
float color_matrix[16];
float color_matrix_nv12_chroma[16];
};
bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
@ -177,6 +179,7 @@ void pop_gles2_debug(struct wlr_gles2_renderer *renderer);
struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *buffer,
struct wlr_egl_context *prev_ctx, struct wlr_gles2_render_timer *timer,
struct wlr_drm_syncobj_timeline *signal_timeline, uint64_t signal_point);
struct wlr_drm_syncobj_timeline *signal_timeline, uint64_t signal_point,
enum wlr_color_encoding color_encoding, enum wlr_color_range color_range);
#endif