<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 14, 2016 at 10:49 AM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Less typing and word wrapping issues than intrin->variables[0]->var.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
 src/compiler/nir/nir_lower_io.c | 28 ++++++++++++----------------<br>
 1 file changed, 12 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c<br>
index c25790a..9b53eff 100644<br>
--- a/src/compiler/nir/nir_lower_io.c<br>
+++ b/src/compiler/nir/nir_lower_io.c<br>
@@ -265,7 +265,8 @@ nir_lower_io_block(nir_block *block,<br>
          continue;<br>
       }<br>
<br>
-      nir_variable_mode mode = intrin->variables[0]->var->data.mode;<br>
+      nir_variable *var = intrin->variables[0]->var;<br>
+      nir_variable_mode mode = var->data.mode;<br>
<br>
       if ((state->modes & mode) == 0)<br>
          continue;<br>
@@ -280,9 +281,9 @@ nir_lower_io_block(nir_block *block,<br>
<br>
       switch (intrin->intrinsic) {<br>
       case nir_intrinsic_load_var: {<br>
-         bool per_vertex =<br>
-            is_per_vertex_input(state, intrin->variables[0]->var) ||<br>
-            is_per_vertex_output(state, intrin->variables[0]->var);<br>
+         const bool per_vertex =<br>
+            is_per_vertex_input(state, var) ||<br>
+            is_per_vertex_output(state, var);<br>
<br>
          nir_ssa_def *offset;<br>
          nir_ssa_def *vertex_index;<br>
@@ -297,15 +298,13 @@ nir_lower_io_block(nir_block *block,<br>
          load->num_components = intrin->num_components;<br>
<br>
          nir_intrinsic_set_base(load,<br>
-            intrin->variables[0]->var->data.driver_location);<br>
+            var->data.driver_location);<br></blockquote><div><br></div><div>Does this still need to be wrapped?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          if (mode == nir_var_shader_in || mode == nir_var_shader_out) {<br>
-            nir_intrinsic_set_component(load,<br>
-               intrin->variables[0]->var->data.location_frac);<br>
+            nir_intrinsic_set_component(load, var->data.location_frac);<br>
          }<br>
<br>
          if (load->intrinsic == nir_intrinsic_load_uniform) {<br>
-            nir_intrinsic_set_range(load,<br>
-               state->type_size(intrin->variables[0]->var->type));<br>
+            nir_intrinsic_set_range(load, state->type_size(var->type));<br>
          }<br>
<br>
          if (per_vertex)<br>
@@ -334,8 +333,7 @@ nir_lower_io_block(nir_block *block,<br>
          nir_ssa_def *offset;<br>
          nir_ssa_def *vertex_index;<br>
<br>
-         bool per_vertex =<br>
-            is_per_vertex_output(state, intrin->variables[0]->var);<br>
+         const bool per_vertex = is_per_vertex_output(state, var);<br>
<br>
          offset = get_io_offset(b, intrin->variables[0],<br>
                                 per_vertex ? &vertex_index : NULL,<br>
@@ -349,10 +347,9 @@ nir_lower_io_block(nir_block *block,<br>
          nir_src_copy(&store->src[0], &intrin->src[0], store);<br>
<br>
          nir_intrinsic_set_base(store,<br>
-            intrin->variables[0]->var->data.driver_location);<br>
+            var->data.driver_location);<br></blockquote><div><br></div><div>Same here<br><br></div><div>Other than that, nice cleanup!<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          if (mode == nir_var_shader_out) {<br>
-            nir_intrinsic_set_component(store,<br>
-               intrin->variables[0]->var->data.location_frac);<br>
+            nir_intrinsic_set_component(store, var->data.location_frac);<br>
          }<br>
          nir_intrinsic_set_write_mask(store, nir_intrinsic_write_mask(intrin));<br>
<br>
@@ -389,8 +386,7 @@ nir_lower_io_block(nir_block *block,<br>
<br>
          atomic->src[0] = nir_src_for_ssa(offset);<br>
<br>
-         atomic->const_index[0] =<br>
-            intrin->variables[0]->var->data.driver_location;<br>
+         atomic->const_index[0] = var->data.driver_location;<br>
<br>
          for (unsigned i = 0;<br>
               i < nir_op_infos[intrin->intrinsic].num_inputs;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.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="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>