<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>></p>
<div class="gmail_quote">On Oct 15, 2015 15:17, "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">VS, GS, and FS continue doing the same thing they did before.  We can<br>
simplify the FS code a bit because it is always scalar.<br>
<br>
Compute shaders now assert that there are no outputs instead of doing<br>
a loop over 0 outputs.<br>
<br>
Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a><br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_nir.c | 26 +++++++++++++++++++++-----<br>
 1 file changed, 21 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c<br>
index af9d041..1b4dace 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_nir.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_nir.c<br>
@@ -112,11 +112,27 @@ brw_nir_lower_inputs(nir_shader *nir, bool is_scalar)<br>
 static void<br>
 brw_nir_lower_outputs(nir_shader *nir, bool is_scalar)<br>
 {<br>
-   if (is_scalar) {<br>
-      nir_assign_var_locations(&nir->outputs, &nir->num_outputs, type_size_scalar);<br>
-   } else {<br>
-      nir_foreach_variable(var, &nir->outputs)<br>
-         var->data.driver_location = var->data.location;<br>
+   switch (nir->stage) {<br>
+   case MESA_SHADER_VERTEX:<br>
+   case MESA_SHADER_GEOMETRY:<br>
+      if (is_scalar) {<br>
+         nir_assign_var_locations(&nir->outputs, &nir->num_outputs,<br>
+                                  type_size_scalar);<br>
+      } else {<br>
+         nir_foreach_variable(var, &nir->outputs)<br>
+            var->data.driver_location = var->data.location;<br>
+      }<br>
+      break;<br>
+   case MESA_SHADER_FRAGMENT:<br>
+      nir_assign_var_locations(&nir->outputs, &nir->num_outputs,<br>
+                               type_size_scalar);<br>
+      break;<br>
+   case MESA_SHADER_COMPUTE:<br>
+      /* Compute shaders have no outputs. */<br>
+      assert(exec_list_is_empty(&nir->outputs));<br>
+      break;<br>
+   default:<br>
+      unreachable("unsupported shader stage");<br>
    }<br>
 }<br>
<br>
--<br>
2.6.1<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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>