diff options
author | Jason Ekstrand <[email protected]> | 2014-11-26 15:07:27 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:19:02 -0800 |
commit | 26865f858d48dd473fc294f7fe14c964715cd55e (patch) | |
tree | 35cf87f49ab702750a247f1f05603a6eb00434fa | |
parent | 29e607e5cf5fbd8a99657ca12d362a3a3fa5ba58 (diff) |
i965/fs_nir: Use the new variable lowering code
This commit switches us over to the new variable lowering code which is
capable of properly handling lowering indirects as we go.
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 0cd8fca274f..dbb2470f34b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -21,6 +21,8 @@ * IN THE SOFTWARE. */ +#include "glsl/ir.h" +#include "glsl/ir_optimization.h" #include "glsl/nir/glsl_to_nir.h" #include "brw_fs.h" @@ -28,35 +30,21 @@ void fs_visitor::emit_nir_code() { /* first, lower the GLSL IR shader to NIR */ + lower_output_reads(shader->base.ir); nir_shader *nir = glsl_to_nir(shader->base.ir, NULL, true); nir_validate_shader(nir); - /* lower some of the GLSL-isms into NIR-isms - after this point, we no - * longer have to deal with variables inside the shader - */ - - nir_lower_variables_scalar(nir, true, true, true, true); - nir_validate_shader(nir); - - nir_lower_samplers(nir, shader_prog, shader->base.Program); + nir_lower_global_vars_to_local(nir); nir_validate_shader(nir); - nir_lower_system_values(nir); - nir_validate_shader(nir); - - nir_lower_atomics(nir); - nir_validate_shader(nir); - - nir_remove_dead_variables(nir); - nir_opt_global_to_local(nir); - nir_validate_shader(nir); - - nir_convert_to_ssa(nir); + nir_split_var_copies(nir); nir_validate_shader(nir); bool progress; do { progress = false; + nir_lower_variables(nir); + nir_validate_shader(nir); progress |= nir_copy_prop(nir); nir_validate_shader(nir); progress |= nir_opt_dce(nir); @@ -69,11 +57,29 @@ fs_visitor::emit_nir_code() nir_validate_shader(nir); } while (progress); + /* Lower a bunch of stuff */ + nir_lower_io(nir); + nir_validate_shader(nir); + + nir_lower_locals_to_regs(nir); + nir_validate_shader(nir); + + nir_remove_dead_variables(nir); + nir_validate_shader(nir); nir_convert_from_ssa(nir); nir_validate_shader(nir); nir_lower_vec_to_movs(nir); nir_validate_shader(nir); + nir_lower_samplers(nir, shader_prog, shader->base.Program); + nir_validate_shader(nir); + + nir_lower_system_values(nir); + nir_validate_shader(nir); + + nir_lower_atomics(nir); + nir_validate_shader(nir); + /* emit the arrays used for inputs and outputs - load/store intrinsics will * be converted to reads/writes of these arrays */ |