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
vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c)
{
nir_foreach_function(function, s) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
nir_foreach_function_impl(impl, s) {
nir_foreach_block(block, impl) {
vc4_nir_lower_blend_block(block, c);
}
nir_metadata_preserve(function->impl,
nir_metadata_preserve(impl,
nir_metadata_block_index |
nir_metadata_dominance);
}
}
/* If we didn't do alpha-to-coverage on the output color, we still
* 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
vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c)
{
nir_foreach_function(function, s) {
if (function->impl)
vc4_nir_lower_io_impl(c, function->impl);
nir_foreach_function_impl(impl, s) {
vc4_nir_lower_io_impl(c, impl);
}
}

View File

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