radeonsi: get information about FS color outputs from shader_info directly

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 7fee6bd..d38c26d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -101,10 +101,8 @@
 
    if (info->stage == MESA_SHADER_FRAGMENT && !is_input) {
       /* Never use FRAG_RESULT_COLOR directly. */
-      if (semantic == FRAG_RESULT_COLOR) {
+      if (semantic == FRAG_RESULT_COLOR)
          semantic = FRAG_RESULT_DATA0;
-         info->color0_writes_all_cbufs = true;
-      }
       semantic += nir_intrinsic_io_semantics(intr).dual_source_blend_index;
    }
 
@@ -185,7 +183,6 @@
                default:
                   if (semantic >= FRAG_RESULT_DATA0 && semantic <= FRAG_RESULT_DATA7) {
                      unsigned index = semantic - FRAG_RESULT_DATA0;
-                     info->colors_written |= 1 << (index + i);
 
                      if (nir_intrinsic_type(intr) == nir_type_float16)
                         info->output_color_types |= SI_TYPE_FLOAT16 << (index * 2);
@@ -410,6 +407,16 @@
    info->uses_persp_centroid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID);
    info->uses_persp_center = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL);
 
+   if (nir->info.stage == MESA_SHADER_FRAGMENT) {
+      info->colors_written = nir->info.outputs_written >> FRAG_RESULT_DATA0;
+      if (nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
+         info->color0_writes_all_cbufs = true;
+         info->colors_written |= 0x1;
+      }
+      if (nir->info.fs.color_is_dual_source)
+         info->colors_written |= 0x2;
+   }
+
    memset(info->output_semantic_to_slot, -1, sizeof(info->output_semantic_to_slot));
 
    func = (struct nir_function *)exec_list_get_head_const(&nir->functions);