begin replace wlr_renderer with fx_renderer

This commit is contained in:
Will McKinnon 2022-08-09 01:49:41 -04:00
parent 0aa5c4f65d
commit ea33d37362
7 changed files with 204 additions and 91 deletions

View file

@ -2,6 +2,7 @@
#define _SWAY_OPENGL_H
#include <GLES2/gl2.h>
#include "sway/server.h"
struct gles2_tex_shader {
GLuint program;
@ -13,12 +14,14 @@ struct gles2_tex_shader {
};
struct fx_renderer {
// for simple rendering
struct wlr_renderer* wlr_renderer;
struct wlr_egl *egl;
float projection[9];
uint32_t viewport_width;
uint32_t viewport_height;
struct sway_output *current;
// Shaders
struct {
@ -34,7 +37,19 @@ struct fx_renderer {
} shaders;
};
struct fx_renderer *fx_renderer_create(struct wlr_egl *egl);
struct fx_renderer *fx_renderer_create(struct sway_server *server);
void fx_renderer_begin(struct fx_renderer *renderer, struct sway_output *output);
void fx_renderer_end(struct fx_renderer *renderer, pixman_region32_t* damage, struct sway_output* output);
void fx_renderer_scissor(struct wlr_box *box);
bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer,
struct wlr_texture *wlr_texture, const struct wlr_fbox *box,
const float matrix[static 9], float alpha);
bool fx_render_texture_with_matrix(struct fx_renderer *renderer,
struct wlr_texture *wlr_texture, const float matrix[static 9], float alpha);
#endif

View file

@ -5,7 +5,6 @@
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_input_method_v2.h>
@ -35,8 +34,7 @@ struct sway_server {
struct wlr_backend *backend;
// secondary headless backend used for creating virtual outputs on-the-fly
struct wlr_backend *headless_backend;
struct wlr_renderer *renderer;
struct fx_renderer *fx_renderer;
struct fx_renderer *renderer;
struct wlr_allocator *allocator;
struct wlr_compositor *compositor;