<div dir="ltr">Reviewed-by: Connor Abbott <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>><div><br></div><div>Nice job getting this variable lowering stuff all done!<br><div class="gmail_extra"><br><div class="gmail_quote">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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This commit switches us over to the new variable lowering code which is<br>
capable of properly handling lowering indirects as we go.<br>
---<br>
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 44 ++++++++++++++++++--------------<br>
1 file changed, 25 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
index 0cd8fca..dbb2470 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
@@ -21,6 +21,8 @@<br>
* IN THE SOFTWARE.<br>
*/<br>
<br>
+#include "glsl/ir.h"<br>
+#include "glsl/ir_optimization.h"<br>
#include "glsl/nir/glsl_to_nir.h"<br>
#include "brw_fs.h"<br>
<br>
@@ -28,35 +30,21 @@ void<br>
fs_visitor::emit_nir_code()<br>
{<br>
/* first, lower the GLSL IR shader to NIR */<br>
+ lower_output_reads(shader-><a href="http://base.ir" target="_blank">base.ir</a>);<br>
nir_shader *nir = glsl_to_nir(shader-><a href="http://base.ir" target="_blank">base.ir</a>, NULL, true);<br>
nir_validate_shader(nir);<br>
<br>
- /* lower some of the GLSL-isms into NIR-isms - after this point, we no<br>
- * longer have to deal with variables inside the shader<br>
- */<br>
-<br>
- nir_lower_variables_scalar(nir, true, true, true, true);<br>
- nir_validate_shader(nir);<br>
-<br>
- nir_lower_samplers(nir, shader_prog, shader->base.Program);<br>
+ nir_lower_global_vars_to_local(nir);<br>
nir_validate_shader(nir);<br>
<br>
- nir_lower_system_values(nir);<br>
- nir_validate_shader(nir);<br>
-<br>
- nir_lower_atomics(nir);<br>
- nir_validate_shader(nir);<br>
-<br>
- nir_remove_dead_variables(nir);<br>
- nir_opt_global_to_local(nir);<br>
- nir_validate_shader(nir);<br>
-<br>
- nir_convert_to_ssa(nir);<br>
+ nir_split_var_copies(nir);<br>
nir_validate_shader(nir);<br>
<br>
bool progress;<br>
do {<br>
progress = false;<br>
+ nir_lower_variables(nir);<br>
+ nir_validate_shader(nir);<br>
progress |= nir_copy_prop(nir);<br>
nir_validate_shader(nir);<br>
progress |= nir_opt_dce(nir);<br>
@@ -69,11 +57,29 @@ fs_visitor::emit_nir_code()<br>
nir_validate_shader(nir);<br>
} while (progress);<br>
<br>
+ /* Lower a bunch of stuff */<br>
+ nir_lower_io(nir);<br>
+ nir_validate_shader(nir);<br>
+<br>
+ nir_lower_locals_to_regs(nir);<br>
+ nir_validate_shader(nir);<br>
+<br>
+ nir_remove_dead_variables(nir);<br>
+ nir_validate_shader(nir);<br>
nir_convert_from_ssa(nir);<br>
nir_validate_shader(nir);<br>
nir_lower_vec_to_movs(nir);<br>
nir_validate_shader(nir);<br>
<br>
+ nir_lower_samplers(nir, shader_prog, shader->base.Program);<br>
+ nir_validate_shader(nir);<br>
+<br>
+ nir_lower_system_values(nir);<br>
+ nir_validate_shader(nir);<br>
+<br>
+ nir_lower_atomics(nir);<br>
+ nir_validate_shader(nir);<br>
+<br>
/* emit the arrays used for inputs and outputs - load/store intrinsics will<br>
* be converted to reads/writes of these arrays<br>
*/<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.2.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" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div></div>