aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c12
-rw-r--r--render/wlr_renderer.c5
2 files changed, 17 insertions, 0 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 623f378e..f3906125 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -129,6 +129,7 @@ static void draw_quad() {
static bool wlr_gles2_render_surface(struct wlr_renderer_state *state,
struct wlr_surface *surface, const float (*matrix)[16]) {
assert(surface && surface->valid);
+ // TODO: Convert GL formats to WL_SHM formats
switch (surface->format) {
case GL_RGB:
GL_CALL(glUseProgram(shaders.rgb));
@@ -163,6 +164,16 @@ static void wlr_gles2_render_ellipse(struct wlr_renderer_state *state,
draw_quad();
}
+static const enum wl_shm_format *wlr_gles2_formats(
+ struct wlr_renderer_state *state, size_t *len) {
+ static enum wl_shm_format formats[] = {
+ WL_SHM_FORMAT_ARGB8888,
+ WL_SHM_FORMAT_XRGB8888,
+ };
+ *len = sizeof(formats) / sizeof(formats[0]);
+ return formats;
+}
+
static void wlr_gles2_destroy(struct wlr_renderer_state *state) {
// no-op
}
@@ -174,6 +185,7 @@ static struct wlr_renderer_impl wlr_renderer_impl = {
.render_with_matrix = wlr_gles2_render_surface,
.render_quad = wlr_gles2_render_quad,
.render_ellipse = wlr_gles2_render_ellipse,
+ .formats = wlr_gles2_formats,
.destroy = wlr_gles2_destroy
};
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index f48bb3eb..720c5254 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -41,3 +41,8 @@ void wlr_render_colored_ellipse(struct wlr_renderer *r,
const float (*color)[4], const float (*matrix)[16]) {
r->impl->render_ellipse(r->state, color, matrix);
}
+
+const enum wl_shm_format *wlr_renderer_get_formats(
+ struct wlr_renderer *r, size_t *len) {
+ return r->impl->formats(r->state, len);
+}