ac/nir/ps: add no_color_export option

For radv which always do ps lower but may use epilog or not.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22199>
This commit is contained in:
Qiang Yu 2023-03-29 11:50:18 +08:00 committed by Marge Bot
parent c877d26454
commit 471418077a
2 changed files with 11 additions and 1 deletions

View file

@ -321,6 +321,7 @@ typedef struct {
/* Vulkan only */
unsigned enable_mrt_output_nan_fixup;
bool no_color_export;
} ac_nir_lower_ps_options;
void

View file

@ -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