From b26c4014c67e058c493a25928bac84cf6e1ae312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Wed, 11 Mar 2026 14:38:50 -0700 Subject: [PATCH] brw: do not omit RT writes if dual_src_blend is on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dual source blending when one of the sources is not written to leaves those values undefined, but the other should still be valid. By omitting unwritten outputs, we ended up not writing anything at all for the case that OUT1 is written to but OUT0 is undefined. Fixes new CTS tests: dEQP-VK.pipeline.*.blend.dual_source.undefined_output.first* Cc: mesa-stable Signed-off-by: Iván Briano Reviewed-by: Lionel Landwerlin (cherry picked from commit fd556e54f61c4e8e250cb32bf43206412dd295ff) Part-of: --- .pick_status.json | 2 +- src/intel/compiler/brw/brw_compile_fs.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d9170e44148..658c3399142 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5444,7 +5444,7 @@ "description": "brw: do not omit RT writes if dual_src_blend is on", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/compiler/brw/brw_compile_fs.cpp b/src/intel/compiler/brw/brw_compile_fs.cpp index eb2f3c27935..1c13fe7dce3 100644 --- a/src/intel/compiler/brw/brw_compile_fs.cpp +++ b/src/intel/compiler/brw/brw_compile_fs.cpp @@ -63,8 +63,12 @@ brw_do_emit_fb_writes(brw_shader &s, int nr_color_regions, bool replicate_alpha) brw_fb_write_inst *write = NULL; for (int target = 0; target < nr_color_regions; target++) { - /* Skip over outputs that weren't written. */ - if (s.outputs[target].file == BAD_FILE) + /* Skip over outputs that weren't written, unless dual source + * blending is at play. The results may be undefined depending + * on the blending settings, but that's what the user signed + * up for. + */ + if (s.outputs[target].file == BAD_FILE && s.dual_src_output.file == BAD_FILE) continue; const brw_builder abld = bld.annotate( @@ -143,8 +147,7 @@ brw_emit_fb_writes(brw_shader &s) (key->nr_color_regions > 1 && key->alpha_to_coverage && s.sample_mask.file == BAD_FILE); - prog_data->dual_src_blend = (s.dual_src_output.file != BAD_FILE && - s.outputs[0].file != BAD_FILE); + prog_data->dual_src_blend = s.dual_src_output.file != BAD_FILE; assert(!prog_data->dual_src_blend || key->nr_color_regions == 1); /* Following condition implements Wa_14017468336: