diff options
author | Jason Ekstrand <[email protected]> | 2016-12-19 13:11:43 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-12-22 16:27:19 -0800 |
commit | 6d9f576b56e53e26315aa589c72f399dc29e9672 (patch) | |
tree | 6df8f9dd89f4e254cc0aef4070ddb5eb6a1a44c9 /src/compiler/nir/nir.h | |
parent | 1111a05f90e27e9820dd187be16ae41335db6838 (diff) |
nir: Add a pass for moving SPIR-V continue blocks to the ends of loops
When shaders come in from SPIR-V, we handle continue blocks by placing
the contents of the continue inside of a "if (!first_iteration)". We do
this so that we can properly handle the fact that continues in SPIR-V
jump to the continue block at the end of the loop rather than jumping
directly to the top of the loop like they do in NIR. In particular, the
increment step of a simple for loop ends up in the continue block. This
pass looks for this case in loops that don't actually have any continues
and moves the continue contents to the end of the loop instead. We need
this because loop unrolling doesn't work if the increment is inside of a
condition.
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 802a3bbeeab..6557631cc10 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2553,6 +2553,8 @@ bool nir_opt_dead_cf(nir_shader *shader); bool nir_opt_gcm(nir_shader *shader, bool value_number); +bool nir_opt_if(nir_shader *shader); + bool nir_opt_loop_unroll(nir_shader *shader, nir_variable_mode indirect_mask); bool nir_opt_peephole_select(nir_shader *shader, unsigned limit); |