diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-03-04 13:22:28 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-03-10 15:33:36 +0100 |
commit | 9601a2abf024fb8ac400c0df178bb41ec9e5d215 (patch) | |
tree | 76b3e9d8f816333b85ddb86c7bc2a897713c30c6 /render/gles2 | |
parent | 52e40025c46c8f3cb8666e9f501312c284beaff3 (diff) |
output: improve transform matrix calculation
Compute only the transform matrix in the output. The projection matrix
will be calculated inside the gles2 renderer when we start rendering.
The goal is to help the pixman rendering process.
Diffstat (limited to 'render/gles2')
-rw-r--r-- | render/gles2/renderer.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 196d0573..504af574 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -191,6 +191,10 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width, renderer->viewport_width = width; renderer->viewport_height = height; + // refresh projection matrix + wlr_matrix_projection(renderer->projection, width, height, + WL_OUTPUT_TRANSFORM_NORMAL); + // enable transparency glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -271,7 +275,8 @@ static bool gles2_render_subtexture_with_matrix( } float gl_matrix[9]; - wlr_matrix_multiply(gl_matrix, flip_180, matrix); + wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); + wlr_matrix_multiply(gl_matrix, flip_180, gl_matrix); // OpenGL ES 2 requires the glUniformMatrix3fv transpose parameter to be set // to GL_FALSE @@ -325,7 +330,8 @@ static void gles2_render_quad_with_matrix(struct wlr_renderer *wlr_renderer, gles2_get_renderer_in_context(wlr_renderer); float gl_matrix[9]; - wlr_matrix_multiply(gl_matrix, flip_180, matrix); + wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); + wlr_matrix_multiply(gl_matrix, flip_180, gl_matrix); // OpenGL ES 2 requires the glUniformMatrix3fv transpose parameter to be set // to GL_FALSE @@ -355,7 +361,8 @@ static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer, gles2_get_renderer_in_context(wlr_renderer); float gl_matrix[9]; - wlr_matrix_multiply(gl_matrix, flip_180, matrix); + wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); + wlr_matrix_multiply(gl_matrix, flip_180, gl_matrix); // OpenGL ES 2 requires the glUniformMatrix3fv transpose parameter to be set // to GL_FALSE @@ -579,7 +586,7 @@ static bool gles2_blit_dmabuf(struct wlr_renderer *wlr_renderer, // TODO: use ANGLE_framebuffer_blit if available float mat[9]; - wlr_matrix_projection(mat, 1, 1, WL_OUTPUT_TRANSFORM_NORMAL); + wlr_matrix_identity(mat); wlr_renderer_begin(wlr_renderer, dst_attr->width, dst_attr->height); wlr_renderer_clear(wlr_renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 }); |