From 6d1a7df42f658cad131623c762a4b8de77475883 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 22 Mar 2021 12:55:51 +0200 Subject: [PATCH] gl-renderer: move shader list destroy to gl-shaders.c This paves way for making struct gl_shader opaque outside of gl-shaders.c. Signed-off-by: Pekka Paalanen --- libweston/renderer-gl/gl-renderer-internal.h | 3 +++ libweston/renderer-gl/gl-renderer.c | 5 +---- libweston/renderer-gl/gl-shaders.c | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h index b8b6504d..379bafa8 100644 --- a/libweston/renderer-gl/gl-renderer-internal.h +++ b/libweston/renderer-gl/gl-renderer-internal.h @@ -201,6 +201,9 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec); void gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader); +void +gl_renderer_shader_list_destroy(struct gl_renderer *gr); + struct gl_shader * gl_renderer_create_fallback_shader(struct gl_renderer *gr); diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index ef396a3c..b373942d 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -3430,16 +3430,13 @@ gl_renderer_destroy(struct weston_compositor *ec) struct gl_renderer *gr = get_renderer(ec); struct dmabuf_image *image, *next; struct dmabuf_format *format, *next_format; - struct gl_shader *shader, *next_shader; wl_signal_emit(&gr->destroy_signal, gr); if (gr->has_bind_display) gr->unbind_display(gr->egl_display, ec->wl_display); - wl_list_for_each_safe(shader, next_shader, &gr->shader_list, link) - gl_shader_destroy(gr, shader); - + gl_renderer_shader_list_destroy(gr); if (gr->fallback_shader) gl_shader_destroy(gr, gr->fallback_shader); diff --git a/libweston/renderer-gl/gl-shaders.c b/libweston/renderer-gl/gl-shaders.c index 0c5cec7f..e8108738 100644 --- a/libweston/renderer-gl/gl-shaders.c +++ b/libweston/renderer-gl/gl-shaders.c @@ -268,6 +268,15 @@ gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader) free(shader); } +void +gl_renderer_shader_list_destroy(struct gl_renderer *gr) +{ + struct gl_shader *shader, *next_shader; + + wl_list_for_each_safe(shader, next_shader, &gr->shader_list, link) + gl_shader_destroy(gr, shader); +} + static int gl_shader_requirements_cmp(const struct gl_shader_requirements *a, const struct gl_shader_requirements *b)