render: optionally clear buffer before rendering

It's suboptimal to do it separately, and some drivers can do it for free this way
Prevents UNASSIGNED-BestPractices-vkCmdClearAttachments-clear-after-load warning
This commit is contained in:
Julia Tatz 2023-12-12 17:54:27 -05:00 committed by Julia Tatz
parent ce89f49b7a
commit 534266b3f8
4 changed files with 37 additions and 10 deletions

View file

@ -307,6 +307,13 @@ static struct wlr_render_pass *pixman_begin_buffer_pass(struct wlr_renderer *wlr
if (pass == NULL) {
return NULL;
}
if (options->clear_buffer) {
wlr_render_pass_add_rect(&pass->base, &(struct wlr_render_rect_options){
.box = { .width = buffer->buffer->width, .height = buffer->buffer->height },
.color = options->clear_color,
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
});
}
return &pass->base;
}