Untie wlr_backend from wlr_renderer
This commit is contained in:
parent
00e12278c7
commit
33a2eb4b77
|
@ -31,7 +31,7 @@ bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
|
||||||
goto error_gbm;
|
goto error_gbm;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->wlr_rend = wlr_gles2_renderer_create(&drm->backend);
|
renderer->wlr_rend = wlr_gles2_renderer_create(&renderer->egl);
|
||||||
if (!renderer->wlr_rend) {
|
if (!renderer->wlr_rend) {
|
||||||
wlr_log(L_ERROR, "Failed to create WLR renderer");
|
wlr_log(L_ERROR, "Failed to create WLR renderer");
|
||||||
goto error_egl;
|
goto error_egl;
|
||||||
|
|
|
@ -114,7 +114,7 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
backend->renderer = wlr_gles2_renderer_create(&backend->backend);
|
backend->renderer = wlr_gles2_renderer_create(&backend->egl);
|
||||||
if (backend->renderer == NULL) {
|
if (backend->renderer == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to create renderer");
|
wlr_log(L_ERROR, "Failed to create renderer");
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char
|
||||||
backend->remote_display, NULL, WL_SHM_FORMAT_ARGB8888);
|
backend->remote_display, NULL, WL_SHM_FORMAT_ARGB8888);
|
||||||
wlr_egl_bind_display(&backend->egl, backend->local_display);
|
wlr_egl_bind_display(&backend->egl, backend->local_display);
|
||||||
|
|
||||||
backend->renderer = wlr_gles2_renderer_create(&backend->backend);
|
backend->renderer = wlr_gles2_renderer_create(&backend->egl);
|
||||||
if (backend->renderer == NULL) {
|
if (backend->renderer == NULL) {
|
||||||
wlr_log_errno(L_ERROR, "Could not create renderer");
|
wlr_log_errno(L_ERROR, "Could not create renderer");
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,7 +314,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
goto error_event;
|
goto error_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
x11->renderer = wlr_gles2_renderer_create(&x11->backend);
|
x11->renderer = wlr_gles2_renderer_create(&x11->egl);
|
||||||
if (x11->renderer == NULL) {
|
if (x11->renderer == NULL) {
|
||||||
wlr_log(L_ERROR, "Failed to create renderer");
|
wlr_log(L_ERROR, "Failed to create renderer");
|
||||||
goto error_egl;
|
goto error_egl;
|
||||||
|
|
|
@ -196,7 +196,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_create(compositor.backend);
|
struct wlr_egl *egl = wlr_backend_get_egl(compositor.backend);
|
||||||
|
state.renderer = wlr_gles2_renderer_create(egl);
|
||||||
state.cat_texture = wlr_texture_from_pixels(state.renderer,
|
state.cat_texture = wlr_texture_from_pixels(state.renderer,
|
||||||
WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
|
WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
|
||||||
cat_tex.pixel_data);
|
cat_tex.pixel_data);
|
||||||
|
|
|
@ -137,7 +137,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_create(compositor.backend);
|
struct wlr_egl *egl = wlr_backend_get_egl(compositor.backend);
|
||||||
|
state.renderer = wlr_gles2_renderer_create(egl);
|
||||||
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);
|
||||||
|
|
|
@ -192,7 +192,8 @@ int main(int argc, char *argv[]) {
|
||||||
};
|
};
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
struct wlr_egl *egl = wlr_backend_get_egl(compositor.backend);
|
||||||
|
state.renderer = wlr_gles2_renderer_create(egl);
|
||||||
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);
|
||||||
|
|
|
@ -108,7 +108,8 @@ int main(int argc, char *argv[]) {
|
||||||
};
|
};
|
||||||
compositor_init(&compositor);
|
compositor_init(&compositor);
|
||||||
|
|
||||||
state.renderer = wlr_gles2_renderer_create(compositor.backend);
|
struct wlr_egl *egl = wlr_backend_get_egl(compositor.backend);
|
||||||
|
state.renderer = wlr_gles2_renderer_create(egl);
|
||||||
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);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
|
||||||
struct wlr_egl;
|
struct wlr_egl;
|
||||||
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend);
|
|
||||||
|
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wayland-server-protocol.h>
|
#include <wayland-server-protocol.h>
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
#include <wlr/backend.h>
|
|
||||||
#include <wlr/render/egl.h>
|
#include <wlr/render/egl.h>
|
||||||
#include <wlr/render/interface.h>
|
#include <wlr/render/interface.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
@ -400,7 +399,7 @@ extern const GLchar tex_fragment_src_rgba[];
|
||||||
extern const GLchar tex_fragment_src_rgbx[];
|
extern const GLchar tex_fragment_src_rgbx[];
|
||||||
extern const GLchar tex_fragment_src_external[];
|
extern const GLchar tex_fragment_src_external[];
|
||||||
|
|
||||||
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend) {
|
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
|
||||||
struct wlr_gles2_renderer *renderer =
|
struct wlr_gles2_renderer *renderer =
|
||||||
calloc(1, sizeof(struct wlr_gles2_renderer));
|
calloc(1, sizeof(struct wlr_gles2_renderer));
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
|
@ -408,7 +407,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend) {
|
||||||
}
|
}
|
||||||
wlr_renderer_init(&renderer->wlr_renderer, &renderer_impl);
|
wlr_renderer_init(&renderer->wlr_renderer, &renderer_impl);
|
||||||
|
|
||||||
renderer->egl = wlr_backend_get_egl(backend);
|
renderer->egl = egl;
|
||||||
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
|
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
|
||||||
|
|
||||||
renderer->exts_str = (const char*) glGetString(GL_EXTENSIONS);
|
renderer->exts_str = (const char*) glGetString(GL_EXTENSIONS);
|
||||||
|
|
Loading…
Reference in New Issue