r600/sfn: Acquire the number of FS outputs and the write_all info early
authorGert Wollny <gert.wollny@collabora.com>
Tue, 22 Sep 2020 07:21:53 +0000 (09:21 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 22 Sep 2020 14:32:45 +0000 (14:32 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6814>

src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp

index 6fccf38..43e78b7 100644 (file)
@@ -321,13 +321,18 @@ bool FragmentShaderFromNir::do_process_outputs(nir_variable *output)
 
    int loc = output->data.location;
    if (loc == FRAG_RESULT_COLOR &&
-       (m_nir.info.outputs_written & (1ull << loc))) {
+       (m_nir.info.outputs_written & (1ull << loc)) &&
+       !m_dual_source_blend) {
            sh_info().fs_write_all = true;
    }
 
    if (output->data.location == FRAG_RESULT_COLOR ||
        (output->data.location >= FRAG_RESULT_DATA0 &&
         output->data.location <= FRAG_RESULT_DATA7))  {
+      ++m_max_counted_color_exports;
+
+      if (m_max_counted_color_exports > 1)
+         sh_info().fs_write_all = false;
       return true;
    }
    if (output->data.location == FRAG_RESULT_DEPTH ||
@@ -766,7 +771,6 @@ bool FragmentShaderFromNir::emit_export_pixel(const nir_variable *out_var, nir_i
          sh_info().ps_color_export_mask |= mask;
 
          emit_export_instruction(m_last_pixel_export);
-         ++m_max_counted_color_exports;
       };
    } else if (out_var->data.location == FRAG_RESULT_DEPTH ||
               out_var->data.location == FRAG_RESULT_STENCIL ||