nir: Support vec8/vec16 in nir_lower_bit_size
authorJesse Natalie <jenatali@microsoft.com>
Mon, 1 Jun 2020 22:46:03 +0000 (15:46 -0700)
committerJesse Natalie <jenatali@microsoft.com>
Fri, 24 Jul 2020 01:23:07 +0000 (18:23 -0700)
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6030>

src/compiler/nir/nir_lower_bit_size.c

index 38e3fa9c6c01dfa18ffed3f9649e559925e0a044..a6a2032b010b94f4c38e9208748fe792a6c9ae4c 100644 (file)
@@ -39,7 +39,7 @@ lower_instr(nir_builder *bld, nir_alu_instr *alu, unsigned bit_size)
    bld->cursor = nir_before_instr(&alu->instr);
 
    /* Convert each source to the requested bit-size */
-   nir_ssa_def *srcs[4] = { NULL, NULL, NULL, NULL };
+   nir_ssa_def *srcs[NIR_MAX_VEC_COMPONENTS] = { NULL };
    for (unsigned i = 0; i < nir_op_infos[op].num_inputs; i++) {
       nir_ssa_def *src = nir_ssa_for_alu_src(bld, alu, i);
 
@@ -65,7 +65,7 @@ lower_instr(nir_builder *bld, nir_alu_instr *alu, unsigned bit_size)
       else
          lowered_dst = nir_ishr(bld, lowered_dst, nir_imm_int(bld, dst_bit_size));
    } else {
-      lowered_dst = nir_build_alu(bld, op, srcs[0], srcs[1], srcs[2], srcs[3]);
+      lowered_dst = nir_build_alu_src_arr(bld, op, srcs);
    }