From a877ce1abafca632c7059a21be1b6f7f99d199c7 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 8 Feb 2021 17:32:00 +0100 Subject: [PATCH] r600/sfn: remove duplicate barriers Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 500697728e3..76faba15b97 100644 --- a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp @@ -94,6 +94,7 @@ public: int m_loop_nesting; int m_nliterals_in_group; std::set vtx_fetch_results; + bool m_last_op_was_barrier; }; @@ -159,6 +160,8 @@ bool AssemblyFromShaderLegacyImpl::emit(const Instruction::Pointer i) if (i->type() != Instruction::vtx) vtx_fetch_results.clear(); + m_last_op_was_barrier &= i->type() == Instruction::alu; + sfn_log << SfnLog::assembly << "Emit from '" << *i << "\n"; switch (i->type()) { case Instruction::alu: @@ -219,7 +222,8 @@ AssemblyFromShaderLegacyImpl::AssemblyFromShaderLegacyImpl(r600_shader *sh, has_pos_output(false), has_param_output(false), m_loop_nesting(0), - m_nliterals_in_group(0) + m_nliterals_in_group(0), + m_last_op_was_barrier(false) { m_max_color_exports = MAX2(m_key->ps.nr_cbufs, 1); } @@ -250,6 +254,11 @@ bool AssemblyFromShaderLegacyImpl::emit_alu(const AluInstruction& ai, ECFAluOpCo return false; } + if (m_last_op_was_barrier && ai.opcode() == op0_group_barrier) + return true; + + m_last_op_was_barrier = ai.opcode() == op0_group_barrier; + unsigned old_nliterals_in_group = m_nliterals_in_group; for (unsigned i = 0; i < ai.n_sources(); ++i) { auto& s = ai.src(i);