From 258618815b41ed3364b8ad74a52786b1f10fbc3f Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sun, 5 Jul 2020 16:39:09 +0200 Subject: [PATCH] r600/sfn: emit texture instructions in one block Setting the offset must happen in the same CF like using it, so don't emit ALU instruction between the tex instructions. Signed-off-by: Gert Wollny Part-of: --- .../drivers/r600/sfn/sfn_emittexinstruction.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp index a063f6c424e..8764d8adeac 100644 --- a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp @@ -655,6 +655,8 @@ bool EmitTexInstruction::emit_tex_tg4(nir_tex_instr* instr, TexInputs& src) << *reinterpret_cast(instr) << "' (" << __func__ << ")\n"; + TexInstruction *set_ofs = nullptr; + auto tex_op = TexInstruction::gather4; if (instr->is_shadow) { @@ -689,11 +691,10 @@ bool EmitTexInstruction::emit_tex_tg4(nir_tex_instr* instr, TexInputs& src) tex_op = (tex_op == TexInstruction::gather4_c) ? TexInstruction::gather4_c_o : TexInstruction::gather4_o; - auto set_ofs = new TexInstruction(TexInstruction::set_offsets, dummy, + set_ofs = new TexInstruction(TexInstruction::set_offsets, dummy, ofs, sampler.id, - sampler.id + R600_MAX_CONST_BUFFERS, src.sampler_offset); + sampler.id + R600_MAX_CONST_BUFFERS, src.sampler_offset); set_ofs->set_dest_swizzle({7,7,7,7}); - emit_instruction(set_ofs); } } @@ -716,6 +717,9 @@ bool EmitTexInstruction::emit_tex_tg4(nir_tex_instr* instr, TexInputs& src) set_rect_coordinate_flags(instr, irt); + if (set_ofs) + emit_instruction(set_ofs); + emit_instruction(irt); return true; } -- 2.30.2