mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-05-07 02:38:04 +02:00
Merge branch 'import-gles' into 'master'
renderer/gles2: Allow to import textures See merge request wlroots/wlroots!5347
This commit is contained in:
commit
61ec50285f
2 changed files with 24 additions and 0 deletions
|
|
@ -47,5 +47,7 @@ bool wlr_render_timer_is_gles2(const struct wlr_render_timer *timer);
|
|||
bool wlr_texture_is_gles2(const struct wlr_texture *texture);
|
||||
void wlr_gles2_texture_get_attribs(struct wlr_texture *texture,
|
||||
struct wlr_gles2_texture_attribs *attribs);
|
||||
struct wlr_texture *wlr_gles2_texture_from_attribs(struct wlr_renderer *wlr_renderer,
|
||||
struct wlr_gles2_texture_attribs *attribs, int width, int height);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -461,3 +461,25 @@ void wlr_gles2_texture_get_attribs(struct wlr_texture *wlr_texture,
|
|||
.has_alpha = texture->has_alpha,
|
||||
};
|
||||
}
|
||||
|
||||
struct wlr_texture *wlr_gles2_texture_from_attribs(struct wlr_renderer *wlr_renderer,
|
||||
struct wlr_gles2_texture_attribs *attribs, int width, int height) {
|
||||
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
||||
|
||||
if (attribs->target != GL_TEXTURE_2D) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_gles2_texture *texture =
|
||||
gles2_texture_create(renderer, width, height);
|
||||
|
||||
if (texture == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
texture->target = attribs->target;
|
||||
texture->tex = attribs->tex;
|
||||
texture->has_alpha = attribs->has_alpha;
|
||||
|
||||
return &texture->wlr_texture;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue