diff options
author | Connor Abbott <cwabbott0@gmail.com> | 2016-04-12 23:59:06 -0400 |
---|---|---|
committer | Connor Abbott <cwabbott0@gmail.com> | 2016-04-13 00:11:56 -0400 |
commit | e1a97f95fccd801f97775574fee3071496229b00 (patch) | |
tree | c89296f7ee026b3909b810e918078c26871e18eb | |
parent | fae8c75cdc20ce16dacad8d1067fb8b62bb40fc4 (diff) |
vc4: fixup for new nir_foreach_block()nir-foreach-block-rewrite
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_io.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 15 |
4 files changed, 20 insertions, 48 deletions
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index 49a314cdb2..84359b5621 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -674,10 +674,8 @@ vc4_nir_lower_blend_instr(struct vc4_compile *c, nir_builder *b, } static bool -vc4_nir_lower_blend_block(nir_block *block, void *state) +vc4_nir_lower_blend_block(nir_block *block, struct vc4_compile *c) { - struct vc4_compile *c = state; - nir_foreach_instr_safe(block, instr) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -714,8 +712,9 @@ vc4_nir_lower_blend(struct vc4_compile *c) { nir_foreach_function(c->s, function) { if (function->impl) { - nir_foreach_block(function->impl, - vc4_nir_lower_blend_block, c); + nir_foreach_block(function->impl, block) { + vc4_nir_lower_blend_block(block, c); + } nir_metadata_preserve(function->impl, nir_metadata_block_index | diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index d08ad588e5..d8115c12a5 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -438,25 +438,15 @@ vc4_nir_lower_io_instr(struct vc4_compile *c, nir_builder *b, } static bool -vc4_nir_lower_io_block(nir_block *block, void *arg) +vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl) { - struct vc4_compile *c = arg; - nir_function_impl *impl = - nir_cf_node_get_function(&block->cf_node); - nir_builder b; nir_builder_init(&b, impl); - nir_foreach_instr_safe(block, instr) - vc4_nir_lower_io_instr(c, &b, instr); - - return true; -} - -static bool -vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl) -{ - nir_foreach_block(impl, vc4_nir_lower_io_block, c); + nir_foreach_block(impl, block) { + nir_foreach_instr_safe(block, instr) + vc4_nir_lower_io_instr(c, &b, instr); + } nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance); diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c index 8b65cac508..4a249d2cb8 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c @@ -130,30 +130,20 @@ vc4_nir_lower_txf_ms_instr(struct vc4_compile *c, nir_builder *b, } static bool -vc4_nir_lower_txf_ms_block(nir_block *block, void *arg) +vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl) { - struct vc4_compile *c = arg; - nir_function_impl *impl = - nir_cf_node_get_function(&block->cf_node); - nir_builder b; nir_builder_init(&b, impl); - nir_foreach_instr_safe(block, instr) { - if (instr->type == nir_instr_type_tex) { - vc4_nir_lower_txf_ms_instr(c, &b, - nir_instr_as_tex(instr)); + nir_foreach_block(impl, block) { + nir_foreach_instr_safe(block, instr) { + if (instr->type == nir_instr_type_tex) { + vc4_nir_lower_txf_ms_instr(c, &b, + nir_instr_as_tex(instr)); + } } } - return true; -} - -static bool -vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl) -{ - nir_foreach_block(impl, vc4_nir_lower_txf_ms_block, c); - nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance); diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 71a1ebbb31..3d168b8528 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1748,16 +1748,6 @@ static const nir_shader_compiler_options nir_options = { .lower_negate = true, }; -static bool -count_nir_instrs_in_block(nir_block *block, void *state) -{ - int *count = (int *) state; - nir_foreach_instr(block, instr) { - *count = *count + 1; - } - return true; -} - static int count_nir_instrs(nir_shader *nir) { @@ -1765,7 +1755,10 @@ count_nir_instrs(nir_shader *nir) nir_foreach_function(nir, function) { if (!function->impl) continue; - nir_foreach_block(function->impl, count_nir_instrs_in_block, &count); + nir_foreach_block(function->impl, block) { + nir_foreach_instr(block, instr) + count++; + } } return count; } |