From 4018aea9fa7baad1d7bdf473dd1dbc9866fe5818 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 24 Apr 2026 14:52:16 -0700 Subject: [PATCH] nir: Set FRAG_RESULT_DUAL_SRC_BLEND in outputs_written when lowering Detecting dual source blending is currently annoying: you can either look at info->fs.color_is_dual_source, or FRAG_RESULT_DUAL_SRC_BLEND being in the info->outputs_written bitfield. The former is only set if nir_shader_gather_info runs prior to nir_lower_io lowering it to FRAG_RESULT_DUAL_SRC_BLEND. The latter is only set if nir_shader_gather_info runs after the nir_lower_io lowering. Just make the IO lowering also set the outputs_written flag so if you're trying to use FRAG_RESULT_DUAL_SRC_BLEND, you can always check outputs_written without worrying about pass ordering. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_lower_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 96f34780116..e626f219285 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -608,6 +608,7 @@ emit_store(struct lower_io_state *state, nir_def *data, assert(location == FRAG_RESULT_COLOR || location == FRAG_RESULT_DATA0); location = FRAG_RESULT_DUAL_SRC_BLEND; + b->shader->info.outputs_written |= BITFIELD64_BIT(location); dual_src_blend = false; }