jay: Ignore RT store condition if there are no outputs

opt_unconditional_discards may eliminate all render target stores
due to all pixels being discarded.  In that case, it tries to add
one back with a Null RT and no colour/depth/stencil outputs, just
to end the thread.  In that case, we don't want to predicate it on
helper invocations - we just need a basic message to end the thread.

In particular, we already lowered nir_intrinsic_is_helper_invocation
so we don't want to emit it again, as nothing would lower it afterwards.

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42056>
This commit is contained in:
Kenneth Graunke 2026-06-04 16:23:54 -07:00 committed by Marge Bot
parent d4dce9d96c
commit e7cfcf41f4

View file

@ -181,6 +181,10 @@ insert_rt_store(nir_builder *b,
nir_def *sample_mask)
{
bool null_rt = target < 0;
bool eot_only = null_rt &&
!colour &&
nir_def_is_undef(depth) &&
nir_def_is_undef(stencil);
colour = nir_pad_vec4(b, colour ?: nir_undef(b, 4, 32));
dual_colour = nir_pad_vec4(b, dual_colour ?: nir_undef(b, 4, 32));
@ -195,7 +199,7 @@ insert_rt_store(nir_builder *b,
nir_def *src0_alpha = nir_channel_or_undef(b, src0_colour ?: colour, 3);
nir_def *disable = b->shader->info.fs.uses_discard ?
nir_def *disable = b->shader->info.fs.uses_discard && !eot_only ?
nir_is_helper_invocation(b, 1) :
nir_imm_false(b);