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

@ -4,7 +4,7 @@
void wlr_render_pass_init(struct wlr_render_pass *render_pass,
const struct wlr_render_pass_impl *impl) {
assert(impl->submit && impl->add_texture && impl->add_rect);
assert(impl->submit && impl->add_texture && impl->add_rect && impl->clear);
*render_pass = (struct wlr_render_pass){
.impl = impl,
};
@ -34,6 +34,11 @@ void wlr_render_pass_add_rect(struct wlr_render_pass *render_pass,
render_pass->impl->add_rect(render_pass, options);
}
void wlr_render_pass_clear(struct wlr_render_pass *render_pass,
const struct wlr_render_clear_options *options) {
render_pass->impl->clear(render_pass, options);
}
void wlr_render_texture_options_get_src_box(const struct wlr_render_texture_options *options,
struct wlr_fbox *box) {
*box = options->src_box;