diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-06-08 11:30:38 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-06-08 11:30:38 -0400 |
commit | 211488131f675b3f3c59607fb1336b69148023d2 (patch) | |
tree | de6bfb2358ccf54f76277b9ffc2773201e8f0f62 /include | |
parent | fc1dc1b5b0e912fd060f257a0c1f6d5b38d6bb75 (diff) |
Add wlr_shader to wlr-render
Diffstat (limited to 'include')
-rw-r--r-- | include/render.h | 28 | ||||
-rw-r--r-- | include/wlr/render.h | 29 |
2 files changed, 57 insertions, 0 deletions
diff --git a/include/render.h b/include/render.h new file mode 100644 index 00000000..fd1ea024 --- /dev/null +++ b/include/render.h @@ -0,0 +1,28 @@ +#ifndef _WLR_RENDER_INTERNAL_H +#define _WLR_RENDER_INTERNAL_H +#include <stdint.h> +#include <wlr/render.h> +#include <wayland-util.h> +#include <GLES3/gl3.h> +#include <stdbool.h> + +struct wlr_texture { + GLuint tex_id; + uint32_t format; + int width, height; +}; + +struct wlr_shader { + bool valid; + uint32_t format; + GLuint vert; + GLuint program; + struct wl_list link; +}; + +struct wlr_renderer { + struct wlr_shader *shader; + // TODO: EGL stuff +}; + +#endif diff --git a/include/wlr/render.h b/include/wlr/render.h new file mode 100644 index 00000000..d3abfcc3 --- /dev/null +++ b/include/wlr/render.h @@ -0,0 +1,29 @@ +#ifndef _WLR_RENDER_H +#define _WLR_RENDER_H +#include <stdint.h> +#include <wayland-server-protocol.h> + +struct wlr_surface; +struct wlr_surface *wlr_surface_create(); +void wlr_surface_attach_pixels(struct wlr_surface *tex, uint32_t format, + int width, int height, const unsigned char *pixels); +void wlr_surface_attach_shm(struct wlr_surface *tex, uint32_t format, + struct wl_shm_buffer *shm); +// TODO: EGL +void wlr_surface_destroy(struct wlr_surface *tex); + +struct wlr_shader; +struct wlr_shader *wlr_shader_init(const char *vertex); +bool wlr_shader_add_format(struct wlr_shader *shader, uint32_t format, + const char *frag); +bool wlr_shader_use(struct wlr_shader *shader, uint32_t format); +void wlr_shader_destroy(struct wlr_shader *shader); + +struct wlr_renderer; +struct wlr_renderer *wlr_renderer_init(); +void wlr_renderer_set_shader(struct wlr_renderer *renderer, + struct wlr_shader *shader); +bool wlr_render_quad(struct wlr_renderer *renderer, struct wlr_surface *tex, + float x, float y, float width, float height); + +#endif |