Mesa (staging/21.3): aco: fix loading 64-bit inputs with fragment shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 22 07:05:01 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 5f1ec5b752f5748719fcc0499989f6fc3b1ac969
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f1ec5b752f5748719fcc0499989f6fc3b1ac969

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Tue Oct 19 09:16:20 2021 +0200

aco: fix loading 64-bit inputs with fragment shaders

Fixes a bunch of 64-bit IO tests with piglit and Zink.

Cc: 21.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13454>
(cherry picked from commit 996e81fb70419bdf0e7bb9afea18c142897730dc)

---

 .pick_status.json                              |  2 +-
 src/amd/compiler/aco_instruction_selection.cpp | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 66052ee637c..164a621f482 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -355,7 +355,7 @@
         "description": "aco: fix loading 64-bit inputs with fragment shaders",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index b28bd57676b..808e004edfa 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -5284,16 +5284,22 @@ visit_load_input(isel_context* ctx, nir_intrinsic_instr* instr)
          }
       }
 
-      if (instr->dest.ssa.num_components == 1) {
+      if (instr->dest.ssa.num_components == 1 &&
+          instr->dest.ssa.bit_size != 64) {
          bld.vintrp(aco_opcode::v_interp_mov_f32, Definition(dst), Operand::c32(vertex_id),
                     bld.m0(prim_mask), idx, component);
       } else {
+         unsigned num_components = instr->dest.ssa.num_components;
+         if (instr->dest.ssa.bit_size == 64)
+            num_components *= 2;
          aco_ptr<Pseudo_instruction> vec{create_instruction<Pseudo_instruction>(
-            aco_opcode::p_create_vector, Format::PSEUDO, instr->dest.ssa.num_components, 1)};
-         for (unsigned i = 0; i < instr->dest.ssa.num_components; i++) {
+            aco_opcode::p_create_vector, Format::PSEUDO, num_components, 1)};
+         for (unsigned i = 0; i < num_components; i++) {
+            unsigned chan_component = (component + i) % 4;
+            unsigned chan_idx = idx + (component + i) / 4;
             vec->operands[i] = bld.vintrp(
                aco_opcode::v_interp_mov_f32, bld.def(instr->dest.ssa.bit_size == 16 ? v2b : v1),
-               Operand::c32(vertex_id), bld.m0(prim_mask), idx, component + i);
+               Operand::c32(vertex_id), bld.m0(prim_mask), chan_idx, chan_component);
          }
          vec->definitions[0] = Definition(dst);
          bld.insert(std::move(vec));



More information about the mesa-commit mailing list