[Mesa-dev] [PATCH 3/6] glsl: always define data_end union as we always use it on line 369

Alexander von Gluck kallisti5 at unixzen.com
Wed Dec 28 12:27:01 PST 2011


On 28.12.2011 13:51, Ian Romanick wrote:
> On Dec 27, 2011, at 8:35 AM, Brian Paul <brian.e.paul at gmail.com> wrote:
>
>> On Tue, Dec 27, 2011 at 8:41 AM, Alexander von Gluck
>> <kallisti5 at unixzen.com> wrote:
>>>
>>> ---
>>>  src/glsl/link_uniforms.cpp |    2 --
>>>  1 files changed, 0 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
>>> index c7de480..fc1c1f7 100644
>>> --- a/src/glsl/link_uniforms.cpp
>>> +++ b/src/glsl/link_uniforms.cpp
>>> @@ -336,9 +336,7 @@ link_assign_uniform_locations(struct 
>>> gl_shader_program
>>> *prog)
>>>       rzalloc_array(prog, struct gl_uniform_storage, num_user_uniforms);
>>>    union gl_constant_value *data =
>>>       rzalloc_array(uniforms, union gl_constant_value, num_data_slots);
>>> -#ifndef NDEBUG
>>>    union gl_constant_value *data_end = &data[num_data_slots];
>>> -#endif
>>>
>>>    parcel_out_uniform_storage parcel(prog->UniformHash, uniforms, data);
>>>
>>
>> How about moving the assert that uses data_end into the #ifndef NDEBUG
>> test seen above it?
>
> That's my preference.  Brian's patch is
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

Ok-by-me :)  Shouldn't break my version.. and is understandably better logic 
wise.


>> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
>> index c7de480..b331db7 100644
>> --- a/src/glsl/link_uniforms.cpp
>> +++ b/src/glsl/link_uniforms.cpp
>> @@ -365,9 +365,9 @@ link_assign_uniform_locations(struct 
>> gl_shader_program *prog
>>    for (unsigned i = 0; i < num_user_uniforms; i++) {
>>       assert(uniforms[i].storage != NULL);
>>    }
>> -#endif
>>
>>    assert(parcel.values == data_end);
>> +#endif
>>
>>    prog->NumUserUniformStorage = num_user_uniforms;
>>    prog->UniformStorage = uniforms;
>>
>>
>> -Brian


More information about the mesa-dev mailing list