changed renderer name to fx_renderer

This commit is contained in:
Will McKinnon 2022-07-30 18:04:31 -04:00
parent 63b23dc615
commit 0aa5c4f65d
6 changed files with 23 additions and 14 deletions

View file

@ -12,7 +12,7 @@ struct gles2_tex_shader {
GLint tex_attrib; GLint tex_attrib;
}; };
struct gles2_renderer { struct fx_renderer {
struct wlr_egl *egl; struct wlr_egl *egl;
float projection[9]; float projection[9];
@ -34,6 +34,7 @@ struct gles2_renderer {
} shaders; } shaders;
}; };
struct gles2_renderer *gles2_renderer_create(struct wlr_egl *egl); struct fx_renderer *fx_renderer_create(struct wlr_egl *egl);
#endif #endif

View file

@ -36,6 +36,7 @@ struct sway_server {
// secondary headless backend used for creating virtual outputs on-the-fly // secondary headless backend used for creating virtual outputs on-the-fly
struct wlr_backend *headless_backend; struct wlr_backend *headless_backend;
struct wlr_renderer *renderer; struct wlr_renderer *renderer;
struct fx_renderer *fx_renderer;
struct wlr_allocator *allocator; struct wlr_allocator *allocator;
struct wlr_compositor *compositor; struct wlr_compositor *compositor;

View file

@ -12,7 +12,7 @@
#include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_matrix.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include "log.h" #include "log.h"
#include "sway/desktop/opengl.h" #include "sway/desktop/fx_renderer.h"
// TODO: update to hyprland shaders (add sup for rounded corners + add blur shaders) // TODO: update to hyprland shaders (add sup for rounded corners + add blur shaders)
@ -158,7 +158,7 @@ error:
return 0; return 0;
} }
struct gles2_renderer *gles2_renderer_create(struct wlr_egl *egl) { struct fx_renderer *fx_renderer_create(struct wlr_egl *egl) {
// TODO: Hyprland way? // TODO: Hyprland way?
// TODO: handle case of no drm_fd? // TODO: handle case of no drm_fd?
//struct wlr_egl *egl = wlr_egl_create_with_drm_fd(drm_fd); //struct wlr_egl *egl = wlr_egl_create_with_drm_fd(drm_fd);
@ -180,7 +180,7 @@ struct gles2_renderer *gles2_renderer_create(struct wlr_egl *egl) {
return NULL; return NULL;
} }
struct gles2_renderer *renderer = calloc(1, sizeof(struct gles2_renderer)); struct fx_renderer *renderer = calloc(1, sizeof(struct fx_renderer));
if (renderer == NULL) { if (renderer == NULL) {
return NULL; return NULL;
} }
@ -263,7 +263,7 @@ error:
/* /*
// TODO: is gles2_get_renderer_in_context(wlr_renderer) implementation needed? // TODO: is gles2_get_renderer_in_context(wlr_renderer) implementation needed?
static void gles2_begin(struct gles2_renderer *renderer, uint32_t width, static void fx_begin(struct fx_renderer *renderer, uint32_t width,
uint32_t height) { glViewport(0, 0, width, height); renderer->viewport_width = uint32_t height) { glViewport(0, 0, width, height); renderer->viewport_width =
width; renderer->viewport_height = height; width; renderer->viewport_height = height;
@ -295,7 +295,7 @@ static void gles2_scissor(struct wlr_box *box) {
*************************/ *************************/
/* /*
static void gles2_render_rect(struct gles2_renderer *renderer, const struct wlr_box *box, const float color[static 4], const float projection[static 9]) { static void fx_render_rect(struct fx_renderer *renderer, const struct wlr_box *box, const float color[static 4], const float projection[static 9]) {
if (box->width == 0 || box->height == 0) { if (box->width == 0 || box->height == 0) {
return; return;
} }

View file

@ -33,7 +33,7 @@
#include "sway/tree/view.h" #include "sway/tree/view.h"
#include "sway/tree/workspace.h" #include "sway/tree/workspace.h"
#include "sway/desktop/opengl.h" #include "sway/desktop/fx_renderer.h"
struct sway_output *output_by_name_or_id(const char *name_or_id) { struct sway_output *output_by_name_or_id(const char *name_or_id) {
for (int i = 0; i < root->outputs->length; ++i) { for (int i = 0; i < root->outputs->length; ++i) {
@ -878,12 +878,13 @@ void handle_new_output(struct wl_listener *listener, void *data) {
return; return;
} }
// TODO: move me to proper spot // TODO: need different egl?
// TODO: init fx_renderer same way as wlr_renderer?
// TODO: reference wlroots render/wlr_renderer.c: wlr_renderer_autocreate // TODO: reference wlroots render/wlr_renderer.c: wlr_renderer_autocreate
struct wlr_egl *egl = wlr_gles2_renderer_get_egl(server->renderer); struct wlr_egl *egl = wlr_gles2_renderer_get_egl(server->renderer);
struct gles2_renderer *test = gles2_renderer_create(egl); server->fx_renderer = fx_renderer_create(egl);
if (!test) { if (!server->fx_renderer) {
printf("gles2_renderer is null"); printf("fx_renderer is null");
} }
struct sway_output *output = output_create(wlr_output); struct sway_output *output = output_create(wlr_output);

View file

@ -17,7 +17,7 @@
#include "log.h" #include "log.h"
#include "config.h" #include "config.h"
#include "sway/config.h" #include "sway/config.h"
#include "sway/desktop/opengl.h" #include "sway/desktop/fx_renderer.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "sway/input/seat.h" #include "sway/input/seat.h"
#include "sway/layers.h" #include "sway/layers.h"
@ -1028,7 +1028,13 @@ static void render_seatops(struct sway_output *output,
void output_render(struct sway_output *output, struct timespec *when, void output_render(struct sway_output *output, struct timespec *when,
pixman_region32_t *damage) { pixman_region32_t *damage) {
struct wlr_output *wlr_output = output->wlr_output; struct wlr_output *wlr_output = output->wlr_output;
// TODO: replace with swayfx_renderer
struct wlr_renderer *renderer = output->server->renderer; struct wlr_renderer *renderer = output->server->renderer;
struct fx_renderer *fx_renderer = output->server->fx_renderer;
// TODO: remove this check
if (!fx_renderer) {
printf("swayfx_renderer is null");
}
struct sway_workspace *workspace = output->current.active_workspace; struct sway_workspace *workspace = output->current.active_workspace;
if (workspace == NULL) { if (workspace == NULL) {

View file

@ -12,9 +12,9 @@ sway_sources = files(
'xdg_decoration.c', 'xdg_decoration.c',
'desktop/desktop.c', 'desktop/desktop.c',
'desktop/fx_renderer.c',
'desktop/idle_inhibit_v1.c', 'desktop/idle_inhibit_v1.c',
'desktop/layer_shell.c', 'desktop/layer_shell.c',
'desktop/opengl.c',
'desktop/output.c', 'desktop/output.c',
'desktop/render.c', 'desktop/render.c',
'desktop/surface.c', 'desktop/surface.c',