wlr renderer/texture: rename init to create when it does alloc
This commit is contained in:
parent
12782eabfe
commit
f24b3df980
|
@ -598,12 +598,12 @@ static bool wlr_drm_output_set_cursor(struct wlr_output *_output,
|
||||||
wlr_matrix_texture(plane->matrix, plane->width, plane->height,
|
wlr_matrix_texture(plane->matrix, plane->width, plane->height,
|
||||||
output->output.transform ^ WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
output->output.transform ^ WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
||||||
|
|
||||||
plane->wlr_rend = wlr_gles2_renderer_init(&backend->backend);
|
plane->wlr_rend = wlr_gles2_renderer_create(&backend->backend);
|
||||||
if (!plane->wlr_rend) {
|
if (!plane->wlr_rend) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
plane->wlr_tex = wlr_render_texture_init(plane->wlr_rend);
|
plane->wlr_tex = wlr_render_texture_create(plane->wlr_rend);
|
||||||
if (!plane->wlr_tex) {
|
if (!plane->wlr_tex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ int main() {
|
||||||
};
|
};
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_init(compositor.backend);
|
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -193,8 +193,8 @@ int main(int argc, char *argv[]) {
|
||||||
compositor.keyboard_key_cb = handle_keyboard_key;
|
compositor.keyboard_key_cb = handle_keyboard_key;
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_init(compositor.backend);
|
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
||||||
state.cat_texture = wlr_render_texture_init(state.renderer);
|
state.cat_texture = wlr_render_texture_create(state.renderer);
|
||||||
wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ABGR8888,
|
wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ABGR8888,
|
||||||
cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
|
cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
|
||||||
|
|
||||||
|
|
|
@ -132,12 +132,12 @@ int main(int argc, char *argv[]) {
|
||||||
compositor.keyboard_key_cb = handle_keyboard_key;
|
compositor.keyboard_key_cb = handle_keyboard_key;
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_init(compositor.backend);
|
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
state.cat_texture = wlr_render_texture_init(state.renderer);
|
state.cat_texture = wlr_render_texture_create(state.renderer);
|
||||||
if (!state.cat_texture) {
|
if (!state.cat_texture) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -153,7 +153,7 @@ int main(int argc, char *argv[]) {
|
||||||
};
|
};
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_init(compositor.backend);
|
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -107,12 +107,12 @@ int main(int argc, char *argv[]) {
|
||||||
};
|
};
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_init(compositor.backend);
|
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
||||||
if (!state.renderer) {
|
if (!state.renderer) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
state.cat_texture = wlr_render_texture_init(state.renderer);
|
state.cat_texture = wlr_render_texture_create(state.renderer);
|
||||||
if (!state.cat_texture) {
|
if (!state.cat_texture) {
|
||||||
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
wlr_log(L_ERROR, "Could not start compositor, OOM");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -49,7 +49,7 @@ extern struct shaders shaders;
|
||||||
|
|
||||||
const struct pixel_format *gl_format_for_wl_format(enum wl_shm_format fmt);
|
const struct pixel_format *gl_format_for_wl_format(enum wl_shm_format fmt);
|
||||||
|
|
||||||
struct wlr_texture *gles2_texture_init();
|
struct wlr_texture *gles2_texture_create();
|
||||||
|
|
||||||
extern const GLchar quad_vertex_src[];
|
extern const GLchar quad_vertex_src[];
|
||||||
extern const GLchar quad_fragment_src[];
|
extern const GLchar quad_fragment_src[];
|
||||||
|
|
|
@ -12,7 +12,7 @@ void wlr_renderer_end(struct wlr_renderer *r);
|
||||||
/**
|
/**
|
||||||
* Requests a texture handle from this renderer.
|
* Requests a texture handle from this renderer.
|
||||||
*/
|
*/
|
||||||
struct wlr_texture *wlr_render_texture_init(struct wlr_renderer *r);
|
struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r);
|
||||||
/**
|
/**
|
||||||
* Renders the requested texture using the provided matrix. A typical texture
|
* Renders the requested texture using the provided matrix. A typical texture
|
||||||
* rendering goes like so:
|
* rendering goes like so:
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
|
|
||||||
struct wlr_egl;
|
struct wlr_egl;
|
||||||
struct wlr_renderer *wlr_gles2_renderer_init(struct wlr_backend *backend);
|
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct wlr_renderer {
|
||||||
struct wlr_renderer_impl {
|
struct wlr_renderer_impl {
|
||||||
void (*begin)(struct wlr_renderer *renderer, struct wlr_output *output);
|
void (*begin)(struct wlr_renderer *renderer, struct wlr_output *output);
|
||||||
void (*end)(struct wlr_renderer *renderer);
|
void (*end)(struct wlr_renderer *renderer);
|
||||||
struct wlr_texture *(*texture_init)(struct wlr_renderer *renderer);
|
struct wlr_texture *(*texture_create)(struct wlr_renderer *renderer);
|
||||||
bool (*render_with_matrix)(struct wlr_renderer *renderer,
|
bool (*render_with_matrix)(struct wlr_renderer *renderer,
|
||||||
struct wlr_texture *texture, const float (*matrix)[16]);
|
struct wlr_texture *texture, const float (*matrix)[16]);
|
||||||
void (*render_quad)(struct wlr_renderer *renderer,
|
void (*render_quad)(struct wlr_renderer *renderer,
|
||||||
|
|
|
@ -143,11 +143,11 @@ static void wlr_gles2_end(struct wlr_renderer *renderer) {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_texture *wlr_gles2_texture_init(
|
static struct wlr_texture *wlr_gles2_texture_create(
|
||||||
struct wlr_renderer *_renderer) {
|
struct wlr_renderer *_renderer) {
|
||||||
struct wlr_gles2_renderer *renderer =
|
struct wlr_gles2_renderer *renderer =
|
||||||
(struct wlr_gles2_renderer *)_renderer;
|
(struct wlr_gles2_renderer *)_renderer;
|
||||||
return gles2_texture_init(renderer->egl);
|
return gles2_texture_create(renderer->egl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_quad() {
|
static void draw_quad() {
|
||||||
|
@ -231,7 +231,7 @@ static bool wlr_gles2_buffer_is_drm(struct wlr_renderer *_renderer,
|
||||||
static struct wlr_renderer_impl wlr_renderer_impl = {
|
static struct wlr_renderer_impl wlr_renderer_impl = {
|
||||||
.begin = wlr_gles2_begin,
|
.begin = wlr_gles2_begin,
|
||||||
.end = wlr_gles2_end,
|
.end = wlr_gles2_end,
|
||||||
.texture_init = wlr_gles2_texture_init,
|
.texture_create = wlr_gles2_texture_create,
|
||||||
.render_with_matrix = wlr_gles2_render_texture,
|
.render_with_matrix = wlr_gles2_render_texture,
|
||||||
.render_quad = wlr_gles2_render_quad,
|
.render_quad = wlr_gles2_render_quad,
|
||||||
.render_ellipse = wlr_gles2_render_ellipse,
|
.render_ellipse = wlr_gles2_render_ellipse,
|
||||||
|
@ -239,7 +239,7 @@ static struct wlr_renderer_impl wlr_renderer_impl = {
|
||||||
.buffer_is_drm = wlr_gles2_buffer_is_drm,
|
.buffer_is_drm = wlr_gles2_buffer_is_drm,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_renderer *wlr_gles2_renderer_init(struct wlr_backend *backend) {
|
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend) {
|
||||||
init_globals();
|
init_globals();
|
||||||
struct wlr_gles2_renderer *renderer;
|
struct wlr_gles2_renderer *renderer;
|
||||||
if (!(renderer = calloc(1, sizeof(struct wlr_gles2_renderer)))) {
|
if (!(renderer = calloc(1, sizeof(struct wlr_gles2_renderer)))) {
|
||||||
|
|
|
@ -276,7 +276,7 @@ static struct wlr_texture_impl wlr_texture_impl = {
|
||||||
.destroy = gles2_texture_destroy,
|
.destroy = gles2_texture_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_texture *gles2_texture_init(struct wlr_egl *egl) {
|
struct wlr_texture *gles2_texture_create(struct wlr_egl *egl) {
|
||||||
struct wlr_gles2_texture *texture;
|
struct wlr_gles2_texture *texture;
|
||||||
if (!(texture = calloc(1, sizeof(struct wlr_gles2_texture)))) {
|
if (!(texture = calloc(1, sizeof(struct wlr_gles2_texture)))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -23,8 +23,8 @@ void wlr_renderer_end(struct wlr_renderer *r) {
|
||||||
r->impl->end(r);
|
r->impl->end(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_texture *wlr_render_texture_init(struct wlr_renderer *r) {
|
struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r) {
|
||||||
return r->impl->texture_init(r);
|
return r->impl->texture_create(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_render_with_matrix(struct wlr_renderer *r,
|
bool wlr_render_with_matrix(struct wlr_renderer *r,
|
||||||
|
|
|
@ -139,14 +139,14 @@ bool wlr_output_set_cursor(struct wlr_output *output,
|
||||||
|
|
||||||
if (!output->cursor.renderer) {
|
if (!output->cursor.renderer) {
|
||||||
/* NULL egl is okay given that we are only using pixel buffers */
|
/* NULL egl is okay given that we are only using pixel buffers */
|
||||||
output->cursor.renderer = wlr_gles2_renderer_init(NULL);
|
output->cursor.renderer = wlr_gles2_renderer_create(NULL);
|
||||||
if (!output->cursor.renderer) {
|
if (!output->cursor.renderer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!output->cursor.texture) {
|
if (!output->cursor.texture) {
|
||||||
output->cursor.texture = wlr_render_texture_init(output->cursor.renderer);
|
output->cursor.texture = wlr_render_texture_create(output->cursor.renderer);
|
||||||
if (!output->cursor.texture) {
|
if (!output->cursor.texture) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
surface->renderer = renderer;
|
surface->renderer = renderer;
|
||||||
surface->texture = wlr_render_texture_init(renderer);
|
surface->texture = wlr_render_texture_create(renderer);
|
||||||
surface->resource = res;
|
surface->resource = res;
|
||||||
surface->current.scale = 1;
|
surface->current.scale = 1;
|
||||||
surface->pending.scale = 1;
|
surface->pending.scale = 1;
|
||||||
|
|
Loading…
Reference in New Issue