Mesa (master): r600/sfn: emit texture instructions in one block

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 09:42:30 UTC 2020


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sun Jul  5 16:39:09 2020 +0200

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 <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5963>

---

 src/gallium/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<nir_instr*>(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;
 }



More information about the mesa-commit mailing list