mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-21 06:46:46 -04:00
wlr_renderer: Introduce wlr_renderer_raster_upload
This commit is contained in:
parent
5dd7c00a7c
commit
d8def1aa65
10 changed files with 198 additions and 67 deletions
|
|
@ -534,6 +534,13 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
|
|||
free(renderer);
|
||||
}
|
||||
|
||||
static bool _gles2_raster_upload(struct wlr_renderer *wlr_renderer,
|
||||
struct wlr_raster *raster) {
|
||||
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
||||
struct wlr_gles2_texture *texture = gles2_raster_upload(renderer, raster);
|
||||
return texture;
|
||||
}
|
||||
|
||||
static const struct wlr_renderer_impl renderer_impl = {
|
||||
.destroy = gles2_destroy,
|
||||
.bind_buffer = gles2_bind_buffer,
|
||||
|
|
@ -541,6 +548,7 @@ static const struct wlr_renderer_impl renderer_impl = {
|
|||
.end = gles2_end,
|
||||
.clear = gles2_clear,
|
||||
.scissor = gles2_scissor,
|
||||
.raster_upload = _gles2_raster_upload,
|
||||
.render_subtexture_with_matrix = gles2_render_subtexture_with_matrix,
|
||||
.render_quad_with_matrix = gles2_render_quad_with_matrix,
|
||||
.get_shm_texture_formats = gles2_get_shm_texture_formats,
|
||||
|
|
|
|||
|
|
@ -376,6 +376,35 @@ struct wlr_texture *gles2_texture_from_buffer(struct wlr_renderer *wlr_renderer,
|
|||
}
|
||||
}
|
||||
|
||||
struct wlr_gles2_texture *gles2_raster_upload(struct wlr_gles2_renderer *renderer,
|
||||
struct wlr_raster *wlr_raster) {
|
||||
struct wlr_texture *texture;
|
||||
wl_list_for_each(texture, &wlr_raster->sources, link) {
|
||||
if (wlr_texture_is_gles2(texture)) {
|
||||
struct wlr_gles2_texture *gles2_tex =
|
||||
(struct wlr_gles2_texture *)texture;
|
||||
if (gles2_tex->renderer != renderer) {
|
||||
continue;
|
||||
}
|
||||
return gles2_tex;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wlr_raster->buffer) {
|
||||
// we could possibly do a blit with another texture from another renderer,
|
||||
// but this is unsupported currently.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
texture = gles2_texture_from_buffer(&renderer->wlr_renderer, wlr_raster->buffer);
|
||||
if (!texture) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wlr_raster_attach(wlr_raster, texture);
|
||||
return (struct wlr_gles2_texture *)texture;
|
||||
}
|
||||
|
||||
void wlr_gles2_texture_get_attribs(struct wlr_texture *wlr_texture,
|
||||
struct wlr_gles2_texture_attribs *attribs) {
|
||||
struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue