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 <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41122>
This commit is contained in:
Kenneth Graunke 2026-04-24 14:52:16 -07:00 committed by Marge Bot
parent ff34135d05
commit 4018aea9fa

View file

@ -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;
}