gl-renderer: log shader deletions too

This is useful for seeing that the shader program garbage collection
works in a future patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago
parent 40c26a0b7c
commit a8c4dfead5
  1. 2
      libweston/renderer-gl/gl-renderer-internal.h
  2. 4
      libweston/renderer-gl/gl-renderer.c
  3. 26
      libweston/renderer-gl/gl-shaders.c

@ -197,7 +197,7 @@ int
gl_renderer_setup_egl_extensions(struct weston_compositor *ec);
void
gl_shader_destroy(struct gl_shader *shader);
gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader);
struct gl_shader *
gl_shader_create(struct gl_renderer *gr,

@ -3513,10 +3513,10 @@ gl_renderer_destroy(struct weston_compositor *ec)
gr->unbind_display(gr->egl_display, ec->wl_display);
wl_list_for_each_safe(shader, next_shader, &gr->shader_list, link)
gl_shader_destroy(shader);
gl_shader_destroy(gr, shader);
if (gr->fallback_shader)
gl_shader_destroy(gr->fallback_shader);
gl_shader_destroy(gr, gr->fallback_shader);
/* Work around crash in egl_dri2.c's dri2_make_current() - when does this apply? */
eglMakeCurrent(gr->egl_display,

@ -106,14 +106,6 @@ dump_program_with_line_numbers(int count, const char **sources)
free(dumpstr);
}
void
gl_shader_destroy(struct gl_shader *shader)
{
glDeleteProgram(shader->program);
wl_list_remove(&shader->link);
free(shader);
}
static GLuint
compile_shader(GLenum type, int count, const char **sources)
{
@ -257,6 +249,24 @@ error_vertex:
return NULL;
}
void
gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader)
{
char *desc;
if (weston_log_scope_is_enabled(gr->shader_scope)) {
desc = create_shader_description_string(&shader->key);
weston_log_scope_printf(gr->shader_scope,
"Deleting shader program for: %s\n",
desc);
free(desc);
}
glDeleteProgram(shader->program);
wl_list_remove(&shader->link);
free(shader);
}
int
gl_shader_requirements_cmp(const struct gl_shader_requirements *a,
const struct gl_shader_requirements *b)

Loading…
Cancel
Save