[Mesa-dev] [PATCH] mesa/glsl: delete previously linked shaders earlier when linking

Emil Velikov emil.l.velikov at gmail.com
Wed Nov 2 14:47:08 UTC 2016


On 1 November 2016 at 23:47, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> This move the delete linked shaders call to
> _mesa_clear_shader_program_data() which makes sure we delete them
> before returning due to any validation problems.
>
> It also reduces some code duplication.
>
> Cc: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97715
> Cc: "12.0 13.0" <mesa-stable at lists.freedesktop.org>
gl_linked_shader was introduced with commit 1fb8c6df884 ("glsl/mesa:
split gl_shader in two") which happened after 12.0.
I'm not familiar with all the subtleties which that work requires, so
I'm inclined that we want to keep this 13.0 only ?

> --- a/src/mesa/main/shaderobj.c
> +++ b/src/mesa/main/shaderobj.c
> @@ -291,12 +291,18 @@ _mesa_new_shader_program(GLuint name)
>   * Clear (free) the shader program state that gets produced by linking.
>   */
>  void
> -_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
> +_mesa_clear_shader_program_data(struct gl_context *ctx,
> +                                struct gl_shader_program *shProg)
>  {
> -   unsigned i;
> +   for (gl_shader_stage sh = 0; sh < MESA_SHADER_STAGES; sh++) {
> +      if (shProg->_LinkedShaders[sh] != NULL) {
> +         _mesa_delete_linked_shader(ctx, shProg->_LinkedShaders[sh]);
> +         shProg->_LinkedShaders[sh] = NULL;
> +      }
> +   }
>
I think you want a similar hunk in standalone_scaffolding.{cpp,h}
_mesa_clear_shader_program_data().

Thanks
Emil


More information about the mesa-dev mailing list