Module: Mesa
Branch: staging/22.2
Commit: 064abf28b638ba33cade7ad04a897d5ed9289ca2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=064abf28b638ba33cade7ad04a897d5ed9289ca2

Author: Rhys Perry <[email protected]>
Date:   Thu Aug  4 17:56:20 2022 +0100

aco: fix 16-bit VS inputs

Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Fixes: 3fba5bb9cc4 ("aco: implement 16-bit vertex fetches with 
tbuffer_load_format_d16_*")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18225>
(cherry picked from commit 32608444484edaa68223dbd738f3a7850d5bd924)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index 323bd822d83..ccbc1375837 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -9877,7 +9877,7 @@
         "description": "aco: fix 16-bit VS inputs",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "3fba5bb9cc49aa526ce9b108229aa7e01349275d"
     },
diff --git a/src/amd/compiler/aco_instruction_selection.cpp 
b/src/amd/compiler/aco_instruction_selection.cpp
index 3866225d470..f54396f612d 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -5556,7 +5556,7 @@ visit_load_input(isel_context* ctx, nir_intrinsic_instr* 
instr)
          bool use_mubuf =
             (nfmt == V_008F0C_BUF_NUM_FORMAT_FLOAT || nfmt == 
V_008F0C_BUF_NUM_FORMAT_UINT ||
              nfmt == V_008F0C_BUF_NUM_FORMAT_SINT) &&
-            vtx_info->chan_byte_size == 4;
+            vtx_info->chan_byte_size == 4 && bitsize != 16;
          unsigned fetch_dfmt = V_008F0C_BUF_DATA_FORMAT_INVALID;
          if (!use_mubuf) {
             fetch_dfmt =
@@ -5647,7 +5647,7 @@ visit_load_input(isel_context* ctx, nir_intrinsic_instr* 
instr)
             mtbuf->mtbuf().vtx_binding = attrib_binding + 1;
          }
 
-         emit_split_vector(ctx, fetch_dst, fetch_dst.size());
+         emit_split_vector(ctx, fetch_dst, fetch_dst.bytes() * 8 / bitsize);
 
          if (fetch_component == 1) {
             channels[channel_start] = fetch_dst;
@@ -5679,11 +5679,11 @@ visit_load_input(isel_context* ctx, 
nir_intrinsic_instr* instr)
                num_temp++;
                elems[i] = channel;
             } else if (is_float && idx == 3) {
-               vec->operands[i] = Operand::c32(0x3f800000u);
+               vec->operands[i] = bitsize == 16 ? Operand::c16(0x3c00u) : 
Operand::c32(0x3f800000u);
             } else if (!is_float && idx == 3) {
-               vec->operands[i] = Operand::c32(1u);
+               vec->operands[i] = Operand::get_const(ctx->options->gfx_level, 
1u, bitsize / 8u);
             } else {
-               vec->operands[i] = Operand::zero();
+               vec->operands[i] = Operand::zero(bitsize / 8u);
             }
          }
          vec->definitions[0] = Definition(dst);

Reply via email to