render: replace EGL/OpenGL pipeline with wl_shm shared memory
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I15dbcca9d12b5c24ed8c82ecc375f4046a6a6964
This commit is contained in:
parent
7863890002
commit
5ba4407367
6 changed files with 323 additions and 739 deletions
37
include/chroma.h
vendored
37
include/chroma.h
vendored
|
|
@ -3,14 +3,11 @@
|
|||
|
||||
#include "wlr-layer-shell-unstable-v1.h"
|
||||
#include "xdg-shell.h"
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-egl.h>
|
||||
|
||||
#include "chroma_version.h"
|
||||
|
||||
|
|
@ -73,6 +70,7 @@ typedef struct {
|
|||
int channels;
|
||||
char path[MAX_PATH_LEN];
|
||||
bool loaded;
|
||||
bool data_from_stbi; // true if data was allocated by stbi_load
|
||||
int ref_count; // Number of outputs using this image
|
||||
} chroma_image_t;
|
||||
|
||||
|
|
@ -94,10 +92,14 @@ typedef struct {
|
|||
// Rendering context
|
||||
struct wl_surface *surface;
|
||||
struct zwlr_layer_surface_v1 *layer_surface;
|
||||
struct wl_egl_window *egl_window;
|
||||
EGLSurface egl_surface;
|
||||
uint32_t configure_serial;
|
||||
|
||||
// Shared memory buffer
|
||||
struct wl_buffer *shm_buffer;
|
||||
void *shm_data;
|
||||
size_t shm_size;
|
||||
int shm_stride;
|
||||
|
||||
// Associated wallpaper
|
||||
chroma_image_t *image;
|
||||
|
||||
|
|
@ -108,15 +110,6 @@ typedef struct {
|
|||
float anchor_x; // custom X offset (0-100, 50=center)
|
||||
float anchor_y; // custom Y offset (0-100, 50=center)
|
||||
bool config_loaded;
|
||||
|
||||
// OpenGL resource cache
|
||||
GLuint texture_id;
|
||||
GLuint shader_program;
|
||||
GLuint vbo;
|
||||
GLuint ebo;
|
||||
bool gl_resources_initialized;
|
||||
bool texture_uploaded;
|
||||
bool vbo_dirty; // track VBO needs update
|
||||
bool configured; // track if initial configure received
|
||||
} chroma_output_t;
|
||||
|
||||
|
|
@ -159,14 +152,7 @@ typedef struct chroma_state {
|
|||
struct wl_registry *registry;
|
||||
struct wl_compositor *compositor;
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
|
||||
// EGL context
|
||||
EGLDisplay egl_display;
|
||||
EGLContext egl_context;
|
||||
EGLConfig egl_config;
|
||||
|
||||
// Shared OpenGL resources
|
||||
GLuint shader_program;
|
||||
struct wl_shm *shm;
|
||||
|
||||
// Outputs
|
||||
chroma_output_t outputs[MAX_OUTPUTS];
|
||||
|
|
@ -221,13 +207,12 @@ void chroma_output_description(void *data, struct wl_output *output,
|
|||
const char *description);
|
||||
void chroma_output_done(void *data, struct wl_output *output);
|
||||
|
||||
// EGL and rendering
|
||||
int chroma_egl_init(chroma_state_t *state);
|
||||
void chroma_egl_cleanup(chroma_state_t *state);
|
||||
// Rendering and surface management
|
||||
int chroma_surface_create(chroma_state_t *state, chroma_output_t *output);
|
||||
void chroma_surface_destroy(chroma_output_t *output);
|
||||
int chroma_buffer_create(chroma_state_t *state, chroma_output_t *output);
|
||||
void chroma_buffer_destroy(chroma_output_t *output);
|
||||
int chroma_render_wallpaper(chroma_state_t *state, chroma_output_t *output);
|
||||
void chroma_output_invalidate_texture(chroma_output_t *output);
|
||||
|
||||
// Layer shell functions
|
||||
void chroma_layer_surface_configure(void *data,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue