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

Eric Anholt eric at anholt.net
Mon Nov 18 17:13:30 PST 2013


Brian Paul <brianp at vmware.com> writes:

> On 11/18/2013 04:25 PM, Brian Paul wrote:
>> 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);
>
> And yes, it's lame that the same code is in two places.  I could fix 
> that up in a follow-on patch.

It's also lame that my patch loses track of the old LocalParams data and
leaks the memory.  New patch incoming with a totall different plan for
the fix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131118/61f2100a/attachment.pgp>


More information about the mesa-dev mailing list