From 471418077a6fb5df0053b23ab3f3e7dd49b274b0 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Wed, 29 Mar 2023 11:50:18 +0800 Subject: [PATCH] ac/nir/ps: add no_color_export option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For radv which always do ps lower but may use epilog or not. Reviewed-by: Timur Kristóf Signed-off-by: Qiang Yu Part-of: --- src/amd/common/ac_nir.h | 1 + src/amd/common/ac_nir_lower_ps.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir.h b/src/amd/common/ac_nir.h index a8b14cc..e93790f 100644 --- a/src/amd/common/ac_nir.h +++ b/src/amd/common/ac_nir.h @@ -321,6 +321,7 @@ typedef struct { /* Vulkan only */ unsigned enable_mrt_output_nan_fixup; + bool no_color_export; } ac_nir_lower_ps_options; void diff --git a/src/amd/common/ac_nir_lower_ps.c b/src/amd/common/ac_nir_lower_ps.c index 12558d8..0809bad 100644 --- a/src/amd/common/ac_nir_lower_ps.c +++ b/src/amd/common/ac_nir_lower_ps.c @@ -234,7 +234,12 @@ gather_ps_store_output(nir_builder *b, nir_intrinsic_instr *intrin, lower_ps_sta s->output_types[slot] = type; - nir_instr_remove(&intrin->instr); + /* Keep color output instruction if not exported in nir. */ + if (!s->options->no_color_export || + (slot < FRAG_RESULT_DATA0 && slot != FRAG_RESULT_COLOR)) { + nir_instr_remove(&intrin->instr); + } + return true; } @@ -740,6 +745,10 @@ export_ps_outputs(nir_builder *b, lower_ps_state *s) emit_ps_mrtz_export(b, s); + /* When non-monolithic shader, RADV export mrtz in main part and export color in epilog. */ + if (s->options->no_color_export) + return; + unsigned first_color_export = s->exp_num; /* When dual src blend is enabled and we need both src0 and src1 -- 2.7.4