From e7cfcf41f47f2a7be8600decca250d4d2ce0c1aa Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 4 Jun 2026 16:23:54 -0700 Subject: [PATCH] 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 Part-of: --- src/intel/compiler/jay/jay_nir.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/jay/jay_nir.c b/src/intel/compiler/jay/jay_nir.c index b896011b7e6..db2ffb3b655 100644 --- a/src/intel/compiler/jay/jay_nir.c +++ b/src/intel/compiler/jay/jay_nir.c @@ -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);