Module: Mesa
Branch: main
Commit: 90c901a9870f011a0b3faa81bd4b2c7caedb0410
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=90c901a9870f011a0b3faa81bd4b2c7caedb0410

Author: Qiang Yu <[email protected]>
Date:   Fri Aug 11 09:57:42 2023 +0800

aco: handle ps outputs from radeonsi

radeonsi will keep outputs <FRAG_RESULT_DATA0.

Reviewed-by: Rhys Perry <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24973>

---

 src/amd/compiler/aco_instruction_selection.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp 
b/src/amd/compiler/aco_instruction_selection.cpp
index e8d1985f26e..a63fdd0156d 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -5219,7 +5219,20 @@ store_output_to_temps(isel_context* ctx, 
nir_intrinsic_instr* instr)
     * TCS epilog to index tess factor temps using semantic location directly.
     */
    nir_io_semantics sem = nir_intrinsic_io_semantics(instr);
-   unsigned base = sem.location + sem.dual_source_blend_index;
+   unsigned base = sem.location;
+   if (ctx->stage == fragment_fs) {
+      /* color result is a legacy slot which won't appear with data result
+       * at the same time. Here we just use the data slot for it to simplify
+       * code handling for both of them.
+       */
+      if (base == FRAG_RESULT_COLOR)
+         base = FRAG_RESULT_DATA0;
+
+      /* Sencond output of dual source blend just use data1 slot for 
simplicity,
+       * because dual source blend does not support multi render target.
+       */
+      base += sem.dual_source_blend_index;
+   }
    unsigned idx = base * 4u + component;
 
    for (unsigned i = 0; i < 8; ++i) {
@@ -5230,7 +5243,7 @@ store_output_to_temps(isel_context* ctx, 
nir_intrinsic_instr* instr)
       idx++;
    }
 
-   if (ctx->stage == fragment_fs && ctx->program->info.has_epilog) {
+   if (ctx->stage == fragment_fs && ctx->program->info.has_epilog && base >= 
FRAG_RESULT_DATA0) {
       unsigned index = base - FRAG_RESULT_DATA0;
 
       if (nir_intrinsic_src_type(instr) == nir_type_float16) {

Reply via email to