<p dir="ltr"><br>
On Aug 27, 2015 4:08 AM, "Ian Romanick" <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>> wrote:<br>
><br>
> On 08/26/2015 10:11 PM, Jason Ekstrand wrote:<br>
> > On Wed, Aug 26, 2015 at 10:20 AM, Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>> wrote:<br>
> >> From: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
> >><br>
> >> Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
> >> ---<br>
> >>  src/glsl/nir/nir_constant_expressions.py | 13 +++++--------<br>
> >>  1 file changed, 5 insertions(+), 8 deletions(-)<br>
> >><br>
> >> diff --git a/src/glsl/nir/nir_constant_expressions.py b/src/glsl/nir/nir_constant_expressions.py<br>
> >> index e2feff3..099bb77 100644<br>
> >> --- a/src/glsl/nir/nir_constant_expressions.py<br>
> >> +++ b/src/glsl/nir/nir_constant_expressions.py<br>
> >> @@ -226,7 +226,6 @@ static nir_const_value<br>
> >>  evaluate_${name}(unsigned num_components, nir_const_value *_src)<br>
> >>  {<br>
> >>     nir_const_value _dst_val = { { {0, 0, 0, 0} } };<br>
> >> -<br>
> ><br>
> > I'd keep the blank line<br>
> ><br>
> >>     ## For each non-per-component input, create a variable srcN that<br>
> >>     ## contains x, y, z, and w elements which are filled in with the<br>
> >>     ## appropriately-typed values.<br>
> >> @@ -238,7 +237,7 @@ evaluate_${name}(unsigned num_components, nir_const_value *_src)<br>
> >>           <% continue %><br>
> >>        %endif<br>
> >><br>
> >> -   struct ${op.input_types[j]}_vec src${j} = {<br>
> >> +   const struct ${op.input_types[j]}_vec src${j} = {<br>
> >>        % for k in range(op.input_sizes[j]):<br>
> >>           % if op.input_types[j] == "bool":<br>
> >>        _src[${j}].u[${k}] != 0,<br>
> >> @@ -280,17 +279,17 @@ evaluate_${name}(unsigned num_components, nir_const_value *_src)<br>
> >>                 ## Avoid unused variable warnings<br>
> >>                 <% continue %><br>
> >>              % elif op.input_types[j] == "bool":<br>
> >> -      bool src${j} = _src[${j}].u[_i] != 0;<br>
> >> +      const bool src${j} = _src[${j}].u[_i] != 0;<br>
> >>              % else:<br>
> >> -      ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];<br>
> >> +      const ${op.input_types[j]} src${j} = _src[${j}].${op.input_types[j][:1]}[_i];<br>
> >>              % endif<br>
> >>           % endfor<br>
> >> -<br>
> ><br>
> > Same here.  Other than that, I like the cleanup.  With the blank lines kept,<br>
><br>
> You should look at the generated code.  To me, the spurious blank lines<br>
> are the most objectionable part.  If someone submitted C code formatted<br>
> that way, we'd tell them to go fix it.  Right?</p>
<p dir="ltr">The generator, not the generated C code, is what's checked into the repo and is what people will be editing. I'd far rather keep that clean.  Again just run it through indent if it bothers you.</p>
<p dir="ltr">> > Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
> ><br>
> >>           ## Create an appropriately-typed variable dst and assign the<br>
> >>           ## result of the const_expr to it.  If const_expr already contains<br>
> >>           ## writes to dst, just include const_expr directly.<br>
> >>           % if "dst" in op.const_expr:<br>
> >>        ${op.output_type} dst;<br>
> >> +<br>
> >>        ${op.const_expr}<br>
> >>           % else:<br>
> >>        ${op.output_type} dst = ${op.const_expr};<br>
> >> @@ -344,10 +343,8 @@ nir_eval_const_opcode(nir_op op, unsigned num_components,<br>
> >>  {<br>
> >>     switch (op) {<br>
> >>  % for name in sorted(opcodes.iterkeys()):<br>
> >> -   case nir_op_${name}: {<br>
> >> +   case nir_op_${name}:<br>
> >>        return evaluate_${name}(num_components, src);<br>
> >> -      break;<br>
> >> -   }<br>
> >>  % endfor<br>
> >>     default:<br>
> >>        unreachable("shouldn't get here");<br>
> >> --<br>
> >> 2.1.0<br>
> >><br>
> >> _______________________________________________<br>
> >> mesa-dev mailing list<br>
> >> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> >> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
</p>