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 <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago committed by Pekka Paalanen
parent 83e4315e41
commit 6d1a7df42f
  1. 3
      libweston/renderer-gl/gl-renderer-internal.h
  2. 5
      libweston/renderer-gl/gl-renderer.c
  3. 9
      libweston/renderer-gl/gl-shaders.c

@ -201,6 +201,9 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec);
void void
gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader); gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader);
void
gl_renderer_shader_list_destroy(struct gl_renderer *gr);
struct gl_shader * struct gl_shader *
gl_renderer_create_fallback_shader(struct gl_renderer *gr); gl_renderer_create_fallback_shader(struct gl_renderer *gr);

@ -3430,16 +3430,13 @@ gl_renderer_destroy(struct weston_compositor *ec)
struct gl_renderer *gr = get_renderer(ec); struct gl_renderer *gr = get_renderer(ec);
struct dmabuf_image *image, *next; struct dmabuf_image *image, *next;
struct dmabuf_format *format, *next_format; struct dmabuf_format *format, *next_format;
struct gl_shader *shader, *next_shader;
wl_signal_emit(&gr->destroy_signal, gr); wl_signal_emit(&gr->destroy_signal, gr);
if (gr->has_bind_display) if (gr->has_bind_display)
gr->unbind_display(gr->egl_display, ec->wl_display); gr->unbind_display(gr->egl_display, ec->wl_display);
wl_list_for_each_safe(shader, next_shader, &gr->shader_list, link) gl_renderer_shader_list_destroy(gr);
gl_shader_destroy(gr, shader);
if (gr->fallback_shader) if (gr->fallback_shader)
gl_shader_destroy(gr, gr->fallback_shader); gl_shader_destroy(gr, gr->fallback_shader);

@ -268,6 +268,15 @@ gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader)
free(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 static int
gl_shader_requirements_cmp(const struct gl_shader_requirements *a, gl_shader_requirements_cmp(const struct gl_shader_requirements *a,
const struct gl_shader_requirements *b) const struct gl_shader_requirements *b)

Loading…
Cancel
Save