vc4: Convert to use nir_foreach_function_impl when possible

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23988>
This commit is contained in:
Yonggang Luo
2023-06-30 02:54:48 +08:00
committed by Marge Bot
parent 7ed9ec70c0
commit 9cfded7f1b
3 changed files with 11 additions and 16 deletions

View File

@@ -598,17 +598,15 @@ vc4_nir_lower_blend_block(nir_block *block, struct vc4_compile *c)
void void
vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c) vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c)
{ {
nir_foreach_function(function, s) { nir_foreach_function_impl(impl, s) {
if (function->impl) { nir_foreach_block(block, impl) {
nir_foreach_block(block, function->impl) {
vc4_nir_lower_blend_block(block, c); vc4_nir_lower_blend_block(block, c);
} }
nir_metadata_preserve(function->impl, nir_metadata_preserve(impl,
nir_metadata_block_index | nir_metadata_block_index |
nir_metadata_dominance); nir_metadata_dominance);
} }
}
/* If we didn't do alpha-to-coverage on the output color, we still /* If we didn't do alpha-to-coverage on the output color, we still
* need to pass glSampleMask() through. * need to pass glSampleMask() through.

View File

@@ -372,8 +372,7 @@ vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl)
void void
vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c) vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c)
{ {
nir_foreach_function(function, s) { nir_foreach_function_impl(impl, s) {
if (function->impl) vc4_nir_lower_io_impl(c, impl);
vc4_nir_lower_io_impl(c, function->impl);
} }
} }

View File

@@ -2200,10 +2200,8 @@ static int
count_nir_instrs(nir_shader *nir) count_nir_instrs(nir_shader *nir)
{ {
int count = 0; int count = 0;
nir_foreach_function(function, nir) { nir_foreach_function_impl(impl, nir) {
if (!function->impl) nir_foreach_block(block, impl) {
continue;
nir_foreach_block(block, function->impl) {
nir_foreach_instr(instr, block) nir_foreach_instr(instr, block)
count++; count++;
} }