[Mesa-dev] [PATCH 3/9] glsl: minor simplification in assign_varying_locations()

Timothy Arceri tarceri at itsqueeze.com
Tue Dec 19 09:14:46 UTC 2017


On 19/12/17 19:47, Tapani Pälli wrote:
> On 12/18/2017 10:47 PM, Brian Paul wrote:
>> ---
>>   src/compiler/glsl/link_varyings.cpp | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/compiler/glsl/link_varyings.cpp 
>> b/src/compiler/glsl/link_varyings.cpp
>> index 9039c3b..6d74f9a 100644
>> --- a/src/compiler/glsl/link_varyings.cpp
>> +++ b/src/compiler/glsl/link_varyings.cpp
>> @@ -2514,11 +2514,9 @@ assign_varying_locations(struct gl_context *ctx,
>>          */
>>         foreach_in_list(ir_instruction, node, consumer->ir) {
>>            ir_variable *const input_var = node->as_variable();
>> -
>> -         if (input_var == NULL || input_var->data.mode != 
>> ir_var_shader_in)
>> -            continue;
>> -
>> -         matches.record(NULL, input_var);
>> +         if (input_var && input_var->data.mode == ir_var_shader_in) {
>> +            matches.record(NULL, input_var);
>> +         }
> 
> this file seems to have mixed style overall but new code should be 
> without braces when we have just one line inside?

I'm pretty sure we have no rules about this. We have had bugs in the 
past due to missing braces on if statements so personally I'm fine with 
braces around single lines.

> 
>>         }
>>      }
>>
> _______________________________________________
> 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