[Mesa-dev] [PATCH] mesa: Fix setup of LocalParams array.

Brian Paul brianp at vmware.com
Mon Nov 18 15:25:50 PST 2013


On 11/18/2013 11:07 AM, Eric Anholt wrote:
> i965 passed piglit, but swrast and gallium both segfaulted without this.
> i965 happened to work because it never ran _mesa_load_state_parameters()
> on the new program before the test called glProgramLocalParameter(), which
> was allocating a LocalParams array for the fallback path.
>
> Bugzilla: https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D71734&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=n3QosB0LfKkjHz3sK6d%2F4MBWkl%2BZgLi1HA1PNmcAH4Q%3D%0A&s=8ce86f72ab8d603739e1c773d926cb29e6f912ee659e0e7181ee3da13da6ec7b
> ---
>   src/mesa/program/arbprogparse.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
> index 5b96650..5d92176 100644
> --- a/src/mesa/program/arbprogparse.c
> +++ b/src/mesa/program/arbprogparse.c
> @@ -127,6 +127,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
>      if (program->Base.Parameters)
>         _mesa_free_parameter_list(program->Base.Parameters);
>      program->Base.Parameters    = prog.Parameters;
> +   program->Base.LocalParams = prog.LocalParams;
>
>      /* Append fog instructions now if the program has "OPTION ARB_fog_exp"
>       * or similar.  We used to leave this up to drivers, but it appears
>

The same change needs to be done in the _mesa_parse_arb_vertex_program() 
function too:

@@ -205,6 +206,7 @@ _mesa_parse_arb_vertex_program(struct gl_context 
*ctx, GLenu
     if (program->Base.Parameters)
        _mesa_free_parameter_list(program->Base.Parameters);
     program->Base.Parameters = prog.Parameters;
+   program->Base.LocalParams = prog.LocalParams;

  #if DEBUG_VP
     printf("____________Vertex program %u __________\n", program->Base.Id);


With those changes the piglit ARB_vertex/fragment_program crashes are fixed.

If you update the patch:

Tested-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

-Brian



More information about the mesa-dev mailing list