Mesa (master): aco: use nir_get_io_offset_src() in visit_load_input()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 22 12:52:45 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Sep 11 17:17:51 2020 +0100

aco: use nir_get_io_offset_src() in visit_load_input()

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6689>

---

 src/amd/compiler/aco_instruction_selection.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 101bcf305f2..03d986abf53 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -4735,21 +4735,21 @@ void visit_load_input(isel_context *ctx, nir_intrinsic_instr *instr)
             ctx->allocated_vec.emplace(dst.id(), elems);
       }
    } else if (ctx->shader->info.stage == MESA_SHADER_FRAGMENT) {
-      unsigned offset_idx = instr->intrinsic == nir_intrinsic_load_input ? 0 : 1;
-      nir_instr *off_instr = instr->src[offset_idx].ssa->parent_instr;
+      nir_src *off_src = nir_get_io_offset_src(instr);
+      nir_instr *off_instr = off_src->ssa->parent_instr;
       if (off_instr->type != nir_instr_type_load_const ||
           nir_instr_as_load_const(off_instr)->value[0].u32 != 0) {
          isel_err(off_instr, "Unimplemented nir_intrinsic_load_input offset");
       }
 
       Temp prim_mask = get_arg(ctx, ctx->args->ac.prim_mask);
-      nir_const_value* offset = nir_src_as_const_value(instr->src[offset_idx]);
+      nir_const_value* offset = nir_src_as_const_value(*off_src);
       if (offset) {
          assert(offset->u32 == 0);
       } else {
          /* the lower 15bit of the prim_mask contain the offset into LDS
           * while the upper bits contain the number of prims */
-         Temp offset_src = get_ssa_temp(ctx, instr->src[offset_idx].ssa);
+         Temp offset_src = get_ssa_temp(ctx, off_src->ssa);
          assert(offset_src.regClass() == s1 && "TODO: divergent offsets...");
          Builder bld(ctx->program, ctx->block);
          Temp stride = bld.sop2(aco_opcode::s_lshr_b32, bld.def(s1), bld.def(s1, scc), prim_mask, Operand(16u));



More information about the mesa-commit mailing list