aco: do not abort if the FS doesn't export anything but has an epilog
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 24 Jun 2022 12:39:10 +0000 (14:39 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 18 Jul 2022 18:40:02 +0000 (18:40 +0000)
The main fragment shader can only export MRTZ (if present) and the
epilog will export colors.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17485>

src/amd/compiler/aco_assembler.cpp

index 0a6feff..e6b820a 100644 (file)
@@ -808,8 +808,14 @@ fix_exports(asm_context& ctx, std::vector<uint32_t>& out, Program* program)
                exported = true;
                break;
             }
-         } else if ((*it)->definitions.size() && (*it)->definitions[0].physReg() == exec)
+         } else if ((*it)->definitions.size() && (*it)->definitions[0].physReg() == exec) {
             break;
+         } else if ((*it)->opcode == aco_opcode::s_setpc_b64) {
+            /* Do not abort if the main FS has an epilog because it only
+             * exports MRTZ (if present) and the epilog exports colors.
+             */
+            exported |= program->stage.hw == HWStage::FS && program->info.ps.has_epilog;
+         }
          ++it;
       }
    }