galllivm: fix gather offset casting
authorDave Airlie <airlied@redhat.com>
Mon, 20 Jan 2020 03:21:28 +0000 (13:21 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 23 Jan 2020 03:48:16 +0000 (13:48 +1000)
cast texture offsets to 32-bit integers

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3528>

src/gallium/auxiliary/gallivm/lp_bld_nir.c

index a8a2f845e299ecaf3cae204472bfdc17b96da56b..7a0e4175b435818c43050da7e331e67300a54681 100644 (file)
@@ -1551,11 +1551,13 @@ static void visit_tex(struct lp_build_nir_context *bld_base, nir_tex_instr *inst
          LLVMValueRef offset_val = get_src(bld_base, instr->src[i].src);
          sample_key |= LP_SAMPLER_OFFSETS;
          if (offset_cnt == 1)
-            offsets[0] = offset_val;
+            offsets[0] = cast_type(bld_base, offset_val, nir_type_int, 32);
          else {
-            for (unsigned chan = 0; chan < offset_cnt; ++chan)
+            for (unsigned chan = 0; chan < offset_cnt; ++chan) {
                offsets[chan] = LLVMBuildExtractValue(builder, offset_val,
                                                      chan, "");
+               offsets[chan] = cast_type(bld_base, offsets[chan], nir_type_int, 32);
+            }
          }
          break;
       }