Mesa (master): r600/sfn: Fix using the result of a fetch instruction in next fetch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 21 15:20:09 UTC 2020


Module: Mesa
Branch: master
Commit: 9c7ce4d76e7b772e9d51dda2532a94d69bd4bee1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c7ce4d76e7b772e9d51dda2532a94d69bd4bee1

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sun Apr 12 16:51:07 2020 +0200

r600/sfn: Fix using the result of a fetch instruction in next fetch

The result of a fetch instruction can't be used as source in the same CF
block, so force a new CF block when the result would be used in the same
vertex fetch block.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

---

 src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp
index cc20d9fbe30..cf76d475679 100644
--- a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp
@@ -88,6 +88,7 @@ public:
    PValue m_last_addr;
    int m_loop_nesting;
    int m_nliterals_in_group;
+   std::set<int> vtx_fetch_results;
 };
 
 
@@ -147,6 +148,9 @@ bool AssemblyFromShaderLegacy::do_lower(const std::vector<InstructionBlock>& ir)
 
 bool AssemblyFromShaderLegacyImpl::emit(const Instruction::Pointer i)
 {
+   if (i->type() != Instruction::vtx)
+       vtx_fetch_results.clear();
+
    sfn_log << SfnLog::assembly << "Emit from '" << *i << "\n";
    switch (i->type()) {
    case Instruction::alu:
@@ -740,6 +744,13 @@ bool AssemblyFromShaderLegacyImpl::emit_vtx(const FetchInstruction& fetch_instr)
       }
    }
 
+   if (vtx_fetch_results.find(fetch_instr.src().sel()) !=
+       vtx_fetch_results.end()) {
+      m_bc->force_add_cf = 1;
+      vtx_fetch_results.clear();
+   }
+   vtx_fetch_results.insert(fetch_instr.dst().sel());
+
    struct r600_bytecode_vtx vtx;
    memset(&vtx, 0, sizeof(vtx));
    vtx.op = fetch_instr.vc_opcode();



More information about the mesa-commit mailing list