<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 4, 2015 at 8:48 PM, Connor Abbott <span dir="ltr"><<a href="mailto:cwabbott0@gmail.com" target="_blank">cwabbott0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm not so sure how I feel about checking that outputs are write-only... eventually we'll want to do lower_input_reads in NIR itself, at which point we'll need to remove that part from the validator. At the same time, for now this is somewhat useful. I'm just not sure if it's worth it (making sure inputs are read-only definitely is, though).</div></blockquote><div><br></div><div>Yes, we may want to do that lowering in NIR and I've already written the pass.  It's lying around somewhere in my git tree.  However, the only producers of NIR that we currently have are GLSL IR which already has the pass, and TGSI which already has the outputs-are-write-only restriction.  For now, I like this bit of validation as it keeps us from breaking other passes that depend on this.<br><br></div><div>Do we want this in the end?  Absoltuely!  We do not want to deal with this in nir_lower_variables.  I tried to but it's an absolute pain.  It's much easier to just remove the copies.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Dec 16, 2014 at 1:11 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">---<br>
 src/glsl/nir/nir_validate.c | 23 +++++++++++++++++++++++<br>
 1 file changed, 23 insertions(+)<br>
<br>
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c<br>
index 80faa15..b8ef802 100644<br>
--- a/src/glsl/nir/nir_validate.c<br>
+++ b/src/glsl/nir/nir_validate.c<br>
@@ -337,6 +337,29 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)<br>
       validate_deref_var(instr->variables[i], state);<br>
    }<br>
<br>
+   switch (instr->intrinsic) {<br>
+   case nir_intrinsic_load_var_vec1:<br>
+   case nir_intrinsic_load_var_vec2:<br>
+   case nir_intrinsic_load_var_vec3:<br>
+   case nir_intrinsic_load_var_vec4:<br>
+      assert(instr->variables[0]->var->data.mode != nir_var_shader_out);<br>
+      break;<br>
+   case nir_intrinsic_store_var_vec1:<br>
+   case nir_intrinsic_store_var_vec2:<br>
+   case nir_intrinsic_store_var_vec3:<br>
+   case nir_intrinsic_store_var_vec4:<br>
+      assert(instr->variables[0]->var->data.mode != nir_var_shader_in &&<br>
+             instr->variables[0]->var->data.mode != nir_var_uniform);<br>
+      break;<br>
+   case nir_intrinsic_copy_var:<br>
+      assert(instr->variables[0]->var->data.mode != nir_var_shader_in &&<br>
+             instr->variables[0]->var->data.mode != nir_var_uniform);<br>
+      assert(instr->variables[1]->var->data.mode != nir_var_shader_out);<br>
+      break;<br>
+   default:<br>
+      break;<br>
+   }<br>
+<br>
    if (instr->has_predicate)<br>
       validate_src(&instr->predicate, state);<br>
 }<br>
</div></div><span class="HOEnZb"><font color="#888888"><span><font color="#888888">--<br>
2.2.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></font></span></blockquote></div><br></div>
</blockquote></div><br></div></div>