diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index 35992840ed4..a5753101751 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -565,38 +565,32 @@ vc4_nir_lower_blend_instr(struct vc4_compile *c, nir_builder *b, } static bool -vc4_nir_lower_blend_block(nir_block *block, struct vc4_compile *c) +vc4_nir_lower_blend_impl(nir_builder *b, nir_intrinsic_instr *intr, void *data) { - nir_foreach_instr_safe(instr, block) { - if (instr->type != nir_instr_type_intrinsic) - continue; - nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); - if (intr->intrinsic != nir_intrinsic_store_output) - continue; + struct vc4_compile *c = data; - unsigned loc = nir_intrinsic_io_semantics(intr).location; + if (intr->intrinsic != nir_intrinsic_store_output) + return false; - if (loc != FRAG_RESULT_COLOR && - loc != FRAG_RESULT_DATA0) { - continue; - } + unsigned loc = nir_intrinsic_io_semantics(intr).location; - nir_builder b = nir_builder_at(nir_before_instr(&intr->instr)); - vc4_nir_lower_blend_instr(c, &b, intr); + if (loc != FRAG_RESULT_COLOR && + loc != FRAG_RESULT_DATA0) { + return false; } + + b->cursor = nir_before_instr(&intr->instr); + + vc4_nir_lower_blend_instr(c, b, intr); + return true; } void vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c) { - nir_foreach_function_impl(impl, s) { - nir_foreach_block(block, impl) { - vc4_nir_lower_blend_block(block, c); - } - - nir_progress(true, impl, nir_metadata_control_flow); - } + nir_shader_intrinsics_pass(s, vc4_nir_lower_blend_impl, + nir_metadata_control_flow, c); /* If we didn't do alpha-to-coverage on the output color, we still * need to pass glSampleMask() through.