aboutsummaryrefslogtreecommitdiff
path: root/render/gles2/renderer.c
diff options
context:
space:
mode:
Diffstat (limited to 'render/gles2/renderer.c')
-rw-r--r--render/gles2/renderer.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index ba03f599..0324ad64 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -9,7 +9,7 @@
#include <wlr/render.h>
#include <wlr/render/egl.h>
#include <wlr/render/interface.h>
-#include <wlr/render/matrix.h>
+#include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h>
#include "render/gles2.h"
#include "glapi.h"
@@ -85,11 +85,13 @@ static void init_default_shaders() {
if (!compile_program(quad_vertex_src, quad_fragment_src, &shaders.quad)) {
goto error;
}
- if (!compile_program(quad_vertex_src, ellipse_fragment_src, &shaders.ellipse)) {
+ if (!compile_program(quad_vertex_src, ellipse_fragment_src,
+ &shaders.ellipse)) {
goto error;
}
if (glEGLImageTargetTexture2DOES) {
- if (!compile_program(quad_vertex_src, fragment_src_external, &shaders.external)) {
+ if (!compile_program(quad_vertex_src, fragment_src_external,
+ &shaders.external)) {
goto error;
}
}
@@ -122,8 +124,8 @@ static void wlr_gles2_end(struct wlr_renderer *wlr_renderer) {
}
static void wlr_gles2_clear(struct wlr_renderer *wlr_renderer,
- const float (*color)[4]) {
- glClearColor((*color)[0], (*color)[1], (*color)[2], (*color)[3]);
+ const float color[static 4]) {
+ glClearColor(color[0], color[1], color[2], color[3]);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -170,15 +172,16 @@ static void draw_quad() {
GL_CALL(glDisableVertexAttribArray(1));
}
-static bool wlr_gles2_render_texture(struct wlr_renderer *wlr_renderer,
- struct wlr_texture *texture, const float (*matrix)[16], float alpha) {
+static bool wlr_gles2_render_texture_with_matrix(
+ struct wlr_renderer *wlr_renderer, struct wlr_texture *texture,
+ const float matrix[static 9], float alpha) {
if (!texture || !texture->valid) {
wlr_log(L_ERROR, "attempt to render invalid texture");
return false;
}
wlr_texture_bind(texture);
- GL_CALL(glUniformMatrix4fv(0, 1, GL_FALSE, *matrix));
+ GL_CALL(glUniformMatrix3fv(0, 1, GL_FALSE, matrix));
GL_CALL(glUniform1i(1, texture->inverted_y));
GL_CALL(glUniform1f(3, alpha));
draw_quad();
@@ -187,18 +190,18 @@ static bool wlr_gles2_render_texture(struct wlr_renderer *wlr_renderer,
static void wlr_gles2_render_quad(struct wlr_renderer *wlr_renderer,
- const float (*color)[4], const float (*matrix)[16]) {
+ const float color[static 4], const float matrix[static 9]) {
GL_CALL(glUseProgram(shaders.quad));
- GL_CALL(glUniformMatrix4fv(0, 1, GL_FALSE, *matrix));
- GL_CALL(glUniform4f(1, (*color)[0], (*color)[1], (*color)[2], (*color)[3]));
+ GL_CALL(glUniformMatrix3fv(0, 1, GL_FALSE, matrix));
+ GL_CALL(glUniform4f(1, color[0], color[1], color[2], color[3]));
draw_quad();
}
static void wlr_gles2_render_ellipse(struct wlr_renderer *wlr_renderer,
- const float (*color)[4], const float (*matrix)[16]) {
+ const float color[static 4], const float matrix[static 9]) {
GL_CALL(glUseProgram(shaders.ellipse));
- GL_CALL(glUniformMatrix4fv(0, 1, GL_TRUE, *matrix));
- GL_CALL(glUniform4f(1, (*color)[0], (*color)[1], (*color)[2], (*color)[3]));
+ GL_CALL(glUniformMatrix3fv(0, 1, GL_TRUE, matrix));
+ GL_CALL(glUniform4f(1, color[0], color[1], color[2], color[3]));
draw_quad();
}
@@ -258,7 +261,7 @@ static struct wlr_renderer_impl wlr_renderer_impl = {
.clear = wlr_gles2_clear,
.scissor = wlr_gles2_scissor,
.texture_create = wlr_gles2_texture_create,
- .render_with_matrix = wlr_gles2_render_texture,
+ .render_texture_with_matrix = wlr_gles2_render_texture_with_matrix,
.render_quad = wlr_gles2_render_quad,
.render_ellipse = wlr_gles2_render_ellipse,
.formats = wlr_gles2_formats,