r600/sfn: remove duplicate barriers

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9167>
This commit is contained in:
Gert Wollny 2021-02-08 17:32:00 +01:00 committed by Marge Bot
parent fa588edf15
commit a877ce1aba

View file

@ -94,6 +94,7 @@ public:
int m_loop_nesting;
int m_nliterals_in_group;
std::set<int> 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);