From b5706ef70acf20f7615cff0202ae2b4201aafb5e Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Fri, 23 May 2025 22:46:32 +0200 Subject: [PATCH] vc4: return progress on custom nir lowering Report if the vc4 specific NIR lowering did any progress. Signed-off-by: Juan A. Suarez Romero Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 10 +++++++--- src/gallium/drivers/vc4/vc4_nir_lower_io.c | 6 +++--- src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c | 10 +++++----- src/gallium/drivers/vc4/vc4_qir.h | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index a5753101751..055a0c418e8 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -586,11 +586,12 @@ vc4_nir_lower_blend_impl(nir_builder *b, nir_intrinsic_instr *intr, void *data) return true; } -void +bool vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c) { - nir_shader_intrinsics_pass(s, vc4_nir_lower_blend_impl, - nir_metadata_control_flow, c); + bool progress = + 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. @@ -600,5 +601,8 @@ vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c) nir_builder b = nir_builder_at(nir_after_impl(impl)); vc4_nir_store_sample_mask(c, &b, nir_load_sample_mask_in(&b)); + progress = true; } + + return progress; } diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index 92c56e5f2dd..69a0bd9fe33 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -338,9 +338,9 @@ vc4_nir_lower_io_impl(nir_builder *b, nir_intrinsic_instr *intr, void *data) return true; } -void +bool vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c) { - nir_shader_intrinsics_pass(s, vc4_nir_lower_io_impl, - nir_metadata_control_flow, c); + return nir_shader_intrinsics_pass(s, vc4_nir_lower_io_impl, + nir_metadata_control_flow, c); } 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 56d4929935a..41fd1d72a1d 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c @@ -122,11 +122,11 @@ vc4_nir_lower_txf_ms_filter(const nir_instr *instr, const void *data) nir_instr_as_tex(instr)->op == nir_texop_txf_ms); } -void +bool vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c) { - nir_shader_lower_instructions(s, - vc4_nir_lower_txf_ms_filter, - vc4_nir_lower_txf_ms_instr, - c); + return nir_shader_lower_instructions(s, + vc4_nir_lower_txf_ms_filter, + vc4_nir_lower_txf_ms_instr, + c); } diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h index cb9653a90bf..786b4e7c327 100644 --- a/src/gallium/drivers/vc4/vc4_qir.h +++ b/src/gallium/drivers/vc4/vc4_qir.h @@ -572,11 +572,11 @@ bool qir_opt_dead_code(struct vc4_compile *c); bool qir_opt_peephole_sf(struct vc4_compile *c); bool qir_opt_small_immediates(struct vc4_compile *c); bool qir_opt_vpm(struct vc4_compile *c); -void vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c); -void vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c); +bool vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c); +bool vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c); nir_def *vc4_nir_get_swizzled_channel(struct nir_builder *b, nir_def **srcs, int swiz); -void vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c); +bool vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c); void qir_lower_uniforms(struct vc4_compile *c); uint32_t qpu_schedule_instructions(struct vc4_compile *c);