render/gles2: add wlr_renderer_is_gles2

Export the interface used to determine whether the wlr_renderer object
is gles2.
This commit is contained in:
zccrs 2021-05-28 14:06:49 +08:00 committed by Simon Ser
parent 103edde481
commit fdc40e071e
2 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ struct wlr_gles2_texture_attribs {
bool has_alpha; bool has_alpha;
}; };
bool wlr_renderer_is_gles2(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_gles2(struct wlr_texture *texture); bool wlr_texture_is_gles2(struct wlr_texture *texture);
void wlr_gles2_texture_get_attribs(struct wlr_texture *texture, void wlr_gles2_texture_get_attribs(struct wlr_texture *texture,
struct wlr_gles2_texture_attribs *attribs); struct wlr_gles2_texture_attribs *attribs);

View File

@ -28,9 +28,13 @@ static const GLfloat verts[] = {
static const struct wlr_renderer_impl renderer_impl; static const struct wlr_renderer_impl renderer_impl;
bool wlr_renderer_is_gles2(struct wlr_renderer *wlr_renderer) {
return wlr_renderer->impl == &renderer_impl;
}
struct wlr_gles2_renderer *gles2_get_renderer( struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_renderer *wlr_renderer) { struct wlr_renderer *wlr_renderer) {
assert(wlr_renderer->impl == &renderer_impl); assert(wlr_renderer_is_gles2(wlr_renderer));
return (struct wlr_gles2_renderer *)wlr_renderer; return (struct wlr_gles2_renderer *)wlr_renderer;
} }