diff options
author | Simon Ser <contact@emersion.fr> | 2021-03-26 12:21:23 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-04-08 09:10:03 +0200 |
commit | a109a80dca502bd36d61f1d1b3ad1c708ea5ad09 (patch) | |
tree | bd4b86cb363ce1bc883123c919e652c1e739e3d1 /render/gles2 | |
parent | 9ecfa4343a6d92fa057802a2911281d75a5a4f6f (diff) |
render: drop support for ellipses
For anything more complicated than quads, compositors can easily
ship their own shaders.
Closes: https://github.com/swaywm/wlroots/issues/2759
Diffstat (limited to 'render/gles2')
-rw-r--r-- | render/gles2/renderer.c | 55 | ||||
-rw-r--r-- | render/gles2/shaders.c | 14 |
2 files changed, 0 insertions, 69 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 1814ad07..25cdcf56 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -356,47 +356,6 @@ static void gles2_render_quad_with_matrix(struct wlr_renderer *wlr_renderer, pop_gles2_debug(renderer); } -static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer, - const float color[static 4], const float matrix[static 9]) { - struct wlr_gles2_renderer *renderer = - gles2_get_renderer_in_context(wlr_renderer); - - float gl_matrix[9]; - 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 - wlr_matrix_transpose(gl_matrix, gl_matrix); - - static const GLfloat texcoord[] = { - 1, 0, // top right - 0, 0, // top left - 1, 1, // bottom right - 0, 1, // bottom left - }; - - push_gles2_debug(renderer); - glUseProgram(renderer->shaders.ellipse.program); - - glUniformMatrix3fv(renderer->shaders.ellipse.proj, 1, GL_FALSE, gl_matrix); - glUniform4f(renderer->shaders.ellipse.color, color[0], color[1], color[2], color[3]); - - glVertexAttribPointer(renderer->shaders.ellipse.pos_attrib, 2, GL_FLOAT, - GL_FALSE, 0, verts); - glVertexAttribPointer(renderer->shaders.ellipse.tex_attrib, 2, GL_FLOAT, - GL_FALSE, 0, texcoord); - - glEnableVertexAttribArray(renderer->shaders.ellipse.pos_attrib); - glEnableVertexAttribArray(renderer->shaders.ellipse.tex_attrib); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glDisableVertexAttribArray(renderer->shaders.ellipse.pos_attrib); - glDisableVertexAttribArray(renderer->shaders.ellipse.tex_attrib); - pop_gles2_debug(renderer); -} - static const uint32_t *gles2_get_shm_texture_formats( struct wlr_renderer *wlr_renderer, size_t *len) { return get_gles2_shm_formats(len); @@ -584,7 +543,6 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) { push_gles2_debug(renderer); glDeleteProgram(renderer->shaders.quad.program); - glDeleteProgram(renderer->shaders.ellipse.program); glDeleteProgram(renderer->shaders.tex_rgba.program); glDeleteProgram(renderer->shaders.tex_rgbx.program); glDeleteProgram(renderer->shaders.tex_ext.program); @@ -614,7 +572,6 @@ static const struct wlr_renderer_impl renderer_impl = { .scissor = gles2_scissor, .render_subtexture_with_matrix = gles2_render_subtexture_with_matrix, .render_quad_with_matrix = gles2_render_quad_with_matrix, - .render_ellipse_with_matrix = gles2_render_ellipse_with_matrix, .get_shm_texture_formats = gles2_get_shm_texture_formats, .resource_is_wl_drm_buffer = gles2_resource_is_wl_drm_buffer, .wl_drm_buffer_get_size = gles2_wl_drm_buffer_get_size, @@ -755,7 +712,6 @@ static void load_gl_proc(void *proc_ptr, const char *name) { extern const GLchar quad_vertex_src[]; extern const GLchar quad_fragment_src[]; -extern const GLchar ellipse_fragment_src[]; extern const GLchar tex_vertex_src[]; extern const GLchar tex_fragment_src_rgba[]; extern const GLchar tex_fragment_src_rgbx[]; @@ -848,16 +804,6 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { renderer->shaders.quad.color = glGetUniformLocation(prog, "color"); renderer->shaders.quad.pos_attrib = glGetAttribLocation(prog, "pos"); - renderer->shaders.ellipse.program = prog = - link_program(renderer, quad_vertex_src, ellipse_fragment_src); - if (!renderer->shaders.ellipse.program) { - goto error; - } - renderer->shaders.ellipse.proj = glGetUniformLocation(prog, "proj"); - renderer->shaders.ellipse.color = glGetUniformLocation(prog, "color"); - renderer->shaders.ellipse.pos_attrib = glGetAttribLocation(prog, "pos"); - renderer->shaders.ellipse.tex_attrib = glGetAttribLocation(prog, "texcoord"); - renderer->shaders.tex_rgba.program = prog = link_program(renderer, tex_vertex_src, tex_fragment_src_rgba); if (!renderer->shaders.tex_rgba.program) { @@ -904,7 +850,6 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { error: glDeleteProgram(renderer->shaders.quad.program); - glDeleteProgram(renderer->shaders.ellipse.program); glDeleteProgram(renderer->shaders.tex_rgba.program); glDeleteProgram(renderer->shaders.tex_rgbx.program); glDeleteProgram(renderer->shaders.tex_ext.program); diff --git a/render/gles2/shaders.c b/render/gles2/shaders.c index 4ebfc0bc..d854b270 100644 --- a/render/gles2/shaders.c +++ b/render/gles2/shaders.c @@ -25,20 +25,6 @@ const GLchar quad_fragment_src[] = " gl_FragColor = v_color;\n" "}\n"; -// Colored ellipses -const GLchar ellipse_fragment_src[] = -"precision mediump float;\n" -"varying vec4 v_color;\n" -"varying vec2 v_texcoord;\n" -"\n" -"void main() {\n" -" float l = length(v_texcoord - vec2(0.5, 0.5));\n" -" if (l > 0.5) {\n" -" discard;\n" -" }\n" -" gl_FragColor = v_color;\n" -"}\n"; - // Textured quads const GLchar tex_vertex_src[] = "uniform mat3 proj;\n" |