From 35ea8b6cd26bcea93f7157bacea4c781b45fd0aa Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 17 Sep 2024 09:45:27 +0300 Subject: [PATCH] brw: disable null_rt only if color output does not affect other outputs We found out that some HW changes on Xe2 make the HW avoid reading the blend state if we're using the null_rt bit in the extended descriptor. Since the alpha_to_coverage bit resides in the blend state, that state is ignored and writes are going through to the depth/stencil buffers. Disable null_rt in the color outputs if the color outputs can affect other outputs (through alpha_to_coverage & omask). Fixes tests in this pattern on Xe2 : dEQP-VK.pipeline.*.multisample.alpha_to_coverage_no_color_attachment.* Signed-off-by: Lionel Landwerlin Backport-to: 24.2 Reviewed-by: Ivan Briano Part-of: --- src/intel/compiler/brw_compile_fs.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_compile_fs.cpp b/src/intel/compiler/brw_compile_fs.cpp index 83fd5bf0948..d29c520b73e 100644 --- a/src/intel/compiler/brw_compile_fs.cpp +++ b/src/intel/compiler/brw_compile_fs.cpp @@ -82,6 +82,17 @@ brw_do_emit_fb_writes(fs_visitor &s, int nr_color_regions, bool replicate_alpha) } if (inst == NULL) { + struct brw_wm_prog_key *key = (brw_wm_prog_key*) s.key; + struct brw_wm_prog_data *prog_data = brw_wm_prog_data(s.prog_data); + /* Disable null_rt if any non color output is written or if + * alpha_to_coverage can be enabled. Since the alpha_to_coverage bit is + * coming from the BLEND_STATE structure and the HW will avoid reading + * it if null_rt is enabled. + */ + const bool use_null_rt = + key->alpha_to_coverage == BRW_NEVER && + !prog_data->uses_omask; + /* Even if there's no color buffers enabled, we still need to send * alpha out the pipeline to our null renderbuffer to support * alpha-testing, alpha-to-coverage, and so on. @@ -95,7 +106,7 @@ brw_do_emit_fb_writes(fs_visitor &s, int nr_color_regions, bool replicate_alpha) bld.LOAD_PAYLOAD(tmp, srcs, 4, 0); inst = brw_emit_single_fb_write(s, bld, tmp, reg_undef, reg_undef, 4, - true); + use_null_rt); inst->target = 0; }