mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-13 08:22:16 -04:00
render: introduce wlr_render_texture_pass
Split texture rendering out of wlr_render_pass and introduce a dedicated wlr_render_texture_pass interface. Remove the add_texture hook from wlr_render_pass_impl and route texture rendering through renderer->texture_pass instead.
This commit is contained in:
parent
33a27b055c
commit
fee962af36
11 changed files with 222 additions and 8 deletions
|
|
@ -230,7 +230,6 @@ static void render_pass_add_rect(struct wlr_render_pass *wlr_pass,
|
|||
|
||||
static const struct wlr_render_pass_impl render_pass_impl = {
|
||||
.submit = render_pass_submit,
|
||||
.add_texture = render_pass_add_texture,
|
||||
};
|
||||
|
||||
static void render_rect_pass_destroy(struct wlr_render_rect_pass *pass) {
|
||||
|
|
@ -272,6 +271,45 @@ struct wlr_pixman_render_rect_pass *wlr_pixman_render_rect_pass_from_pass(
|
|||
return pass;
|
||||
}
|
||||
|
||||
static void render_texture_pass_destroy(struct wlr_render_texture_pass *pass) {
|
||||
struct wlr_pixman_render_texture_pass *pixman_pass =
|
||||
wlr_pixman_render_texture_pass_from_pass(pass);
|
||||
free(pixman_pass);
|
||||
}
|
||||
|
||||
static const struct wlr_render_texture_pass_impl render_texture_pass_impl = {
|
||||
.destroy = render_texture_pass_destroy,
|
||||
.render = render_pass_add_texture,
|
||||
};
|
||||
|
||||
struct wlr_render_texture_pass *wlr_pixman_render_texture_pass_create(void) {
|
||||
struct wlr_pixman_render_texture_pass *pass = malloc(sizeof(*pass));
|
||||
if (pass == NULL) {
|
||||
wlr_log_errno(WLR_ERROR, "failed to allocate wlr_pixman_render_texture_pass");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wlr_render_texture_pass_init(&pass->base, &render_texture_pass_impl);
|
||||
|
||||
return &pass->base;
|
||||
}
|
||||
|
||||
bool wlr_render_texture_pass_is_pixman(const struct wlr_render_texture_pass *texture_pass) {
|
||||
return texture_pass->impl == &render_texture_pass_impl;
|
||||
}
|
||||
|
||||
struct wlr_pixman_render_texture_pass *wlr_pixman_render_texture_pass_from_pass(
|
||||
struct wlr_render_texture_pass *texture_pass) {
|
||||
if (!wlr_render_texture_pass_is_pixman(texture_pass)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_pixman_render_texture_pass *pixman_pass =
|
||||
wl_container_of(texture_pass, pixman_pass, base);
|
||||
|
||||
return pixman_pass;
|
||||
}
|
||||
|
||||
struct wlr_pixman_render_pass *begin_pixman_render_pass(
|
||||
struct wlr_pixman_buffer *buffer) {
|
||||
struct wlr_pixman_render_pass *pass = calloc(1, sizeof(*pass));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue