diff options
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r-- | src/glsl/nir/nir.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index bf001312121..acb251afe8b 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -1335,6 +1335,22 @@ nir_block_get_following_if(nir_block *block) return nir_cf_node_as_if(next_node); } +nir_loop * +nir_block_get_following_loop(nir_block *block) +{ + if (exec_node_is_tail_sentinel(&block->cf_node.node)) + return NULL; + + if (nir_cf_node_is_last(&block->cf_node)) + return NULL; + + nir_cf_node *next_node = nir_cf_node_next(&block->cf_node); + + if (next_node->type != nir_cf_node_loop) + return NULL; + + return nir_cf_node_as_loop(next_node); +} static bool index_block(nir_block *block, void *state) { |