diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 973ea15f56a..4785419d469 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -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++; diff --git a/src/amd/compiler/aco_shader_info.h b/src/amd/compiler/aco_shader_info.h index 49f172f0bd5..5837f51cd5f 100644 --- a/src/amd/compiler/aco_shader_info.h +++ b/src/amd/compiler/aco_shader_info.h @@ -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. diff --git a/src/gallium/drivers/radeonsi/si_shader_aco.c b/src/gallium/drivers/radeonsi/si_shader_aco.c index c89926580a6..edb0e3015ca 100644 --- a/src/gallium/drivers/radeonsi/si_shader_aco.c +++ b/src/gallium/drivers/radeonsi/si_shader_aco.c @@ -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,