From 5099bb53878e8db17443ba9f4563946670bb86ee Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 31 Aug 2022 12:50:38 +0200 Subject: [PATCH] r600/sfn: Override VPM if access in helpers is requested Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_assembler.cpp | 8 ++++++-- src/gallium/drivers/r600/sfn/sfn_instr.h | 1 + src/gallium/drivers/r600/sfn/sfn_instr_mem.cpp | 3 +++ src/gallium/drivers/r600/sfn/sfn_shader.cpp | 8 ++++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_assembler.cpp b/src/gallium/drivers/r600/sfn/sfn_assembler.cpp index 265c6ca4f19..a942f38f219 100644 --- a/src/gallium/drivers/r600/sfn/sfn_assembler.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_assembler.cpp @@ -887,9 +887,13 @@ void AssamblerVisitor::visit(const ControlFlowInstr& instr) case ControlFlowInstr::cf_endif: emit_endif(); break; - case ControlFlowInstr::cf_loop_begin: - emit_loop_begin(instr.has_instr_flag(Instr::vpm)); + case ControlFlowInstr::cf_loop_begin: { + bool use_vpm = m_shader->processor_type == PIPE_SHADER_FRAGMENT && + instr.has_instr_flag(Instr::vpm) && + !instr.has_instr_flag(Instr::helper); + emit_loop_begin(use_vpm); break; + } case ControlFlowInstr::cf_loop_end: emit_loop_end(); break; diff --git a/src/gallium/drivers/r600/sfn/sfn_instr.h b/src/gallium/drivers/r600/sfn/sfn_instr.h index d3beb8f40cd..237efe26296 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr.h +++ b/src/gallium/drivers/r600/sfn/sfn_instr.h @@ -69,6 +69,7 @@ public: vpm, force_cf, ack_rat_return_write, + helper, nflags }; diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_mem.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_mem.cpp index 376075de971..7eb01a98744 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_mem.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_mem.cpp @@ -701,6 +701,9 @@ bool RatInstr::emit_image_store(nir_intrinsic_instr *intrin, Shader& shader) image_offset, 1, 0xf, 0); store->set_ack(); + if (nir_intrinsic_access(intrin) & ACCESS_INCLUDE_HELPERS) + store->set_instr_flag(Instr::helper); + shader.emit_instruction(store); return true; } diff --git a/src/gallium/drivers/r600/sfn/sfn_shader.cpp b/src/gallium/drivers/r600/sfn/sfn_shader.cpp index c0a68569ea5..62c54623762 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader.cpp @@ -1071,16 +1071,20 @@ void Shader::InstructionChain::visit(ScratchIOInstr *instr) void Shader::InstructionChain::visit(GDSInstr *instr) { apply(instr, &last_gds_instr); + Instr::Flags flag = instr->has_instr_flag(Instr::helper) ? + Instr::helper: Instr::vpm; for (auto& loop : this_shader->m_loops) { - loop->set_instr_flag(Instr::vpm); + loop->set_instr_flag(flag); } } void Shader::InstructionChain::visit(RatInstr *instr) { apply(instr, &last_ssbo_instr); + Instr::Flags flag = instr->has_instr_flag(Instr::helper) ? + Instr::helper: Instr::vpm; for (auto& loop : this_shader->m_loops) { - loop->set_instr_flag(Instr::vpm); + loop->set_instr_flag(flag); } if (prepare_mem_barrier)