<p dir="ltr">Go ahead and squash this in to the patch that adds the boolean return?</p>
<div class="gmail_quote">On Sep 18, 2015 10:37 AM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
<br>
While we're here, we also fix up a couple of potential ralloc-parenting<br>
bugs.  In particular, we were calling nir_src_copy with the shader as the<br>
mem context instead of the instruction.<br>
<br>
v2 (Ken): Rebase.<br>
<br>
Reviewed-by: Eduardo Lima Mitev <<a href="mailto:elima@igalia.com">elima@igalia.com</a>> [v1]<br>
---<br>
 src/glsl/nir/nir_lower_vec_to_movs.c | 13 ++++++++++---<br>
 1 file changed, 10 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c<br>
index 2cb0457..f5d30be 100644<br>
--- a/src/glsl/nir/nir_lower_vec_to_movs.c<br>
+++ b/src/glsl/nir/nir_lower_vec_to_movs.c<br>
@@ -32,6 +32,10 @@<br>
  * moves with partial writes.<br>
  */<br>
<br>
+struct vec_to_movs_state {<br>
+   nir_function_impl *impl;<br>
+};<br>
+<br>
 static bool<br>
 src_matches_dest_reg(nir_dest *dest, nir_src *src)<br>
 {<br>
@@ -185,9 +189,10 @@ try_coalesce(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader)<br>
 }<br>
<br>
 static bool<br>
-lower_vec_to_movs_block(nir_block *block, void *void_impl)<br>
+lower_vec_to_movs_block(nir_block *block, void *void_state)<br>
 {<br>
-   nir_function_impl *impl = void_impl;<br>
+   struct vec_to_movs_state *state = void_state;<br>
+   nir_function_impl *impl = state->impl;<br>
    nir_shader *shader = impl->overload->function->shader;<br>
<br>
    nir_foreach_instr_safe(block, instr) {<br>
@@ -254,7 +259,9 @@ lower_vec_to_movs_block(nir_block *block, void *void_impl)<br>
 static void<br>
 nir_lower_vec_to_movs_impl(nir_function_impl *impl)<br>
 {<br>
-   nir_foreach_block(impl, lower_vec_to_movs_block, impl);<br>
+   struct vec_to_movs_state state = { impl };<br>
+<br>
+   nir_foreach_block(impl, lower_vec_to_movs_block, &state);<br>
 }<br>
<br>
 void<br>
--<br>
2.5.1<br>
<br>
</blockquote></div>