aco: simplify how broadcast_last_cbuf is implemented in PS epilog

So PS epilogs only need a single bool flag that determines whether all
enabled color buffers should be written.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33024>
This commit is contained in:
Marek Olšák 2024-12-28 14:58:11 -05:00
parent 5c4f737b84
commit a842f198d7
3 changed files with 7 additions and 4 deletions

View file

@ -13183,8 +13183,11 @@ select_ps_epilog(Program* program, void* pinfo, ac_shader_config* config,
struct aco_export_mrt mrts[MAX_DRAW_BUFFERS];
unsigned mrt_num = 0;
if (einfo->broadcast_last_cbuf) {
for (unsigned i = 0; i <= einfo->broadcast_last_cbuf; i++) {
if (einfo->writes_all_cbufs) {
/* This will do nothing for color buffers with SPI_SHADER_COL_FORMAT=ZERO, so always
* iterate over all 8.
*/
for (unsigned i = 0; i < 8; i++) {
struct aco_export_mrt* mrt = &mrts[mrt_num];
if (export_fs_mrt_color(&ctx, einfo, colors[0], i, mrt))
mrt->target += mrt_num++;

View file

@ -65,7 +65,7 @@ struct aco_ps_epilog_info {
uint16_t color_types;
bool clamp_color;
bool skip_null_export;
unsigned broadcast_last_cbuf;
bool writes_all_cbufs;
enum compare_func alpha_func;
/* Depth/stencil/samplemask are always passed via VGPRs, and the epilog key can choose
* not to export them using these flags, which can be dynamic states.

View file

@ -309,7 +309,7 @@ si_aco_build_ps_epilog(struct aco_compiler_options *options,
.spi_shader_col_format = key->ps_epilog.states.spi_shader_col_format,
.color_is_int8 = key->ps_epilog.states.color_is_int8,
.color_is_int10 = key->ps_epilog.states.color_is_int10,
.broadcast_last_cbuf = key->ps_epilog.states.last_cbuf,
.writes_all_cbufs = key->ps_epilog.states.last_cbuf != 0,
.alpha_func = key->ps_epilog.states.alpha_func,
.alpha_to_one = key->ps_epilog.states.alpha_to_one,
.alpha_to_coverage_via_mrtz = key->ps_epilog.states.alpha_to_coverage_via_mrtz,