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

Timothy Arceri timothy.arceri at collabora.com
Thu Nov 3 00:59:32 UTC 2016


On Wed, 2016-11-02 at 14:47 +0000, Emil Velikov wrote:
> 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 ?

Yeah nobody is complaining about this breaking anything besides piglit
so 13.0 is fine. Thanks.

> 
> > 
> > --- 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().

Right fixed and pushed. Thanks.

> 
> Thanks
> Emil
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list