render: add support for clearing render passes

introduces a new `wlr_render_pass_clear` function, allowing
render passes to be cleared with a solid color.
This commit is contained in:
YaoBing Xiao 2026-01-31 21:45:12 +08:00
parent 7cb4e30bfd
commit eeecb382cc
8 changed files with 120 additions and 8 deletions

View file

@ -268,9 +268,8 @@ static struct wlr_buffer *render_cursor_buffer(struct wlr_output_cursor *cursor)
enum wl_output_transform transform = wlr_output_transform_invert(cursor->transform);
transform = wlr_output_transform_compose(transform, output->transform);
wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
.box = { .width = buffer->width, .height = buffer->height },
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
wlr_render_pass_clear(pass, &(struct wlr_render_clear_options){
.color = { 0, 0, 0, 0 },
});
wlr_render_pass_add_texture(pass, &(struct wlr_render_texture_options){
.texture = texture,
@ -535,4 +534,4 @@ bool output_cursor_refresh_color_transform(struct wlr_output_cursor *output_curs
wlr_color_transform_unref(transforms[0]);
wlr_color_transform_unref(transforms[1]);
return output_cursor->color_transform != NULL;
}
}

View file

@ -63,9 +63,8 @@ static struct wlr_buffer *output_acquire_empty_buffer(struct wlr_output *output,
return NULL;
}
wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
wlr_render_pass_clear(pass, &(struct wlr_render_clear_options){
.color = { 0, 0, 0, 0 },
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
});
if (!wlr_render_pass_submit(pass)) {