radeonsi: use ac_get_arg_pointee_type to get the right type
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 10 Oct 2022 10:32:31 +0000 (12:32 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 21 Oct 2022 07:56:38 +0000 (07:56 +0000)
And switch to the xxx2 versions of the ac/llvm functions.

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19035>

src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
src/gallium/drivers/radeonsi/si_shader_llvm.c
src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
src/gallium/drivers/radeonsi/si_shader_llvm_ps.c
src/gallium/drivers/radeonsi/si_shader_llvm_resources.c
src/gallium/drivers/radeonsi/si_shader_llvm_vs.c

index a8e4f65..3fa5330 100644 (file)
@@ -66,17 +66,18 @@ static LLVMValueRef ngg_get_ordered_id(struct si_shader_context *ctx)
 static LLVMValueRef ngg_get_query_buf(struct si_shader_context *ctx)
 {
    LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
-
-   return ac_build_load_to_sgpr(&ctx->ac, buf_ptr,
-                                LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_BUF, false));
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
+   return ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr,
+                                 LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_BUF, false));
 }
 
 static LLVMValueRef ngg_get_emulated_counters_buf(struct si_shader_context *ctx)
 {
    LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
 
-   return ac_build_load_to_sgpr(&ctx->ac, buf_ptr,
-                                LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
+   return ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr,
+                                 LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
 }
 
 /**
@@ -945,9 +946,10 @@ static void cull_primitive(struct si_shader_context *ctx,
    /* Load the viewport state for small prim culling. */
    bool prim_is_lines = shader->key.ge.opt.ngg_culling & SI_NGG_CULL_LINES;
    LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->small_prim_cull_info);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->small_prim_cull_info);
    /* Lines will always use the non-AA viewport transformation. */
-   LLVMValueRef vp = ac_build_load_to_sgpr(&ctx->ac, ptr,
-                                           prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
+   LLVMValueRef vp = ac_build_load_to_sgpr2(&ctx->ac, type, ptr,
+                                            prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
    vp = LLVMBuildBitCast(builder, vp, ctx->ac.v4f32, "");
    vp_scale[0] = ac_llvm_extract_elem(&ctx->ac, vp, 0);
    vp_scale[1] = ac_llvm_extract_elem(&ctx->ac, vp, 1);
@@ -960,9 +962,7 @@ static void cull_primitive(struct si_shader_context *ctx,
    options.cull_w = true;
 
    if (prim_is_lines) {
-      ptr = LLVMBuildPointerCast(ctx->ac.builder, ptr,
-                                 LLVMPointerType(ctx->ac.v2f32, AC_ADDR_SPACE_CONST_32BIT), "");
-      LLVMValueRef terms = ac_build_load_to_sgpr(&ctx->ac, ptr, LLVMConstInt(ctx->ac.i32, 4, 0));
+      LLVMValueRef terms = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v2f32, ptr, LLVMConstInt(ctx->ac.i32, 4, 0));
       terms = LLVMBuildBitCast(builder, terms, ctx->ac.v2f32, "");
       clip_half_line_width[0] = ac_llvm_extract_elem(&ctx->ac, terms, 0);
       clip_half_line_width[1] = ac_llvm_extract_elem(&ctx->ac, terms, 1);
index 41fabf1..376c022 100644 (file)
@@ -766,7 +766,8 @@ static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrin
    case nir_intrinsic_load_tess_level_inner_default: {
       LLVMValueRef slot = LLVMConstInt(ctx->ac.i32, SI_HS_CONST_DEFAULT_TESS_LEVELS, 0);
       LLVMValueRef buf = ac_get_arg(&ctx->ac, ctx->internal_bindings);
-      buf = ac_build_load_to_sgpr(&ctx->ac, buf, slot);
+      LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
+      buf = ac_build_load_to_sgpr2(&ctx->ac, type, buf, slot);
       int offset = op == nir_intrinsic_load_tess_level_inner_default ? 4 : 0;
       LLVMValueRef val[4];
 
@@ -823,8 +824,9 @@ static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrin
    case nir_intrinsic_load_viewport_xy_scale_and_offset: {
       bool prim_is_lines = ctx->shader->key.ge.opt.ngg_culling & SI_NGG_CULL_LINES;
       LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->small_prim_cull_info);
+      LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->small_prim_cull_info);
       LLVMValueRef terms =
-         ac_build_load_to_sgpr(&ctx->ac, ptr, prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
+         ac_build_load_to_sgpr2(&ctx->ac, type, ptr, prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
       return LLVMBuildBitCast(ctx->ac.builder, terms, ctx->ac.v4f32, "");
    }
 
@@ -879,8 +881,9 @@ static LLVMValueRef si_llvm_load_user_clip_plane(struct ac_shader_abi *abi, unsi
 {
    struct si_shader_context *ctx = si_shader_context_from_abi(abi);
    LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
    LLVMValueRef constbuf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_CLIP_PLANES, 0);
-   LLVMValueRef const_resource = ac_build_load_to_sgpr(&ctx->ac, ptr, constbuf_index);
+   LLVMValueRef const_resource = ac_build_load_to_sgpr2(&ctx->ac, type, ptr, constbuf_index);
    LLVMValueRef addr = LLVMConstInt(ctx->ac.i32, ucp_id * 16, 0);
    return ac_build_buffer_load(&ctx->ac, const_resource, 4, NULL, addr, NULL,
                                ctx->ac.f32, 0, true, true);
@@ -890,9 +893,10 @@ static LLVMValueRef si_llvm_load_streamout_buffer(struct ac_shader_abi *abi, uns
 {
    struct si_shader_context *ctx = si_shader_context_from_abi(abi);
    LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
 
-   return ac_build_load_to_sgpr(
-      &ctx->ac, buf_ptr, LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + buffer, false));
+   return ac_build_load_to_sgpr2(
+      &ctx->ac, type, buf_ptr, LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + buffer, false));
 }
 
 bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shader,
@@ -929,9 +933,10 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
       if (ctx->shader->key.ge.opt.ngg_culling &&
           ctx->shader->key.ge.part.vs.prolog.instance_divisor_is_fetched) {
          LLVMValueRef buf = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+         LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
          ctx->instance_divisor_constbuf =
-            ac_build_load_to_sgpr(
-               &ctx->ac, buf, LLVMConstInt(ctx->ac.i32, SI_VS_CONST_INSTANCE_DIVISORS, 0));
+            ac_build_load_to_sgpr2(
+               &ctx->ac, type, buf, LLVMConstInt(ctx->ac.i32, SI_VS_CONST_INSTANCE_DIVISORS, 0));
       }
       break;
 
index 4634fdf..4bc12bd 100644 (file)
@@ -99,9 +99,10 @@ static LLVMValueRef si_get_gs_wave_id(struct si_shader_context *ctx)
 static LLVMValueRef ngg_get_emulated_counters_buf(struct si_shader_context *ctx)
 {
    LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
 
-   return ac_build_load_to_sgpr(&ctx->ac, buf_ptr,
-                                LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
+   return ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr,
+                                 LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
 }
 
 void si_llvm_gs_build_end(struct si_shader_context *ctx)
@@ -306,7 +307,8 @@ void si_preload_gs_rings(struct si_shader_context *ctx)
    LLVMBuilderRef builder = ctx->ac.builder;
    LLVMValueRef offset = LLVMConstInt(ctx->ac.i32, SI_RING_GSVS, 0);
    LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
-   LLVMValueRef base_ring = ac_build_load_to_sgpr(&ctx->ac, buf_ptr, offset);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
+   LLVMValueRef base_ring = ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr, offset);
 
    /* The conceptual layout of the GSVS ring is
     *   v0c0 .. vLv0 v0c1 .. vLc1 ..
@@ -433,8 +435,9 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
    si_llvm_create_main_func(&ctx, false);
 
    LLVMValueRef buf_ptr = ac_get_arg(&ctx.ac, ctx.internal_bindings);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx.ac, &ctx.args, ctx.internal_bindings);
    ctx.gsvs_ring[0] =
-      ac_build_load_to_sgpr(&ctx.ac, buf_ptr, LLVMConstInt(ctx.ac.i32, SI_RING_GSVS, 0));
+      ac_build_load_to_sgpr2(&ctx.ac, type, buf_ptr, LLVMConstInt(ctx.ac.i32, SI_RING_GSVS, 0));
 
    LLVMValueRef voffset =
       LLVMBuildMul(ctx.ac.builder, ctx.abi.vertex_id, LLVMConstInt(ctx.ac.i32, 4, 0), "");
index cd622a2..9277124 100644 (file)
@@ -36,7 +36,8 @@ static LLVMValueRef load_sample_position(struct ac_shader_abi *abi, LLVMValueRef
    struct si_shader_context *ctx = si_shader_context_from_abi(abi);
    LLVMValueRef desc = ac_get_arg(&ctx->ac, ctx->internal_bindings);
    LLVMValueRef buf_index = LLVMConstInt(ctx->ac.i32, SI_PS_CONST_SAMPLE_POSITIONS, 0);
-   LLVMValueRef resource = ac_build_load_to_sgpr(&ctx->ac, desc, buf_index);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
+   LLVMValueRef resource = ac_build_load_to_sgpr2(&ctx->ac, type, desc, buf_index);
 
    /* offset = sample_id * 8  (8 = 2 floats containing samplepos.xy) */
    LLVMValueRef offset0 =
@@ -69,7 +70,7 @@ static LLVMValueRef si_nir_emit_fbfetch(struct ac_shader_abi *abi)
    ptr =
       LLVMBuildPointerCast(ctx->ac.builder, ptr, ac_array_in_const32_addr_space(ctx->ac.v8i32), "");
    image =
-      ac_build_load_to_sgpr(&ctx->ac, ptr, LLVMConstInt(ctx->ac.i32, SI_PS_IMAGE_COLORBUF0 / 2, 0));
+      ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v8i32, ptr, LLVMConstInt(ctx->ac.i32, SI_PS_IMAGE_COLORBUF0 / 2, 0));
 
    unsigned chan = 0;
 
@@ -88,7 +89,8 @@ static LLVMValueRef si_nir_emit_fbfetch(struct ac_shader_abi *abi)
    if (ctx->screen->info.gfx_level < GFX11 &&
        ctx->shader->key.ps.mono.fbfetch_msaa &&
        !(ctx->screen->debug_flags & DBG(NO_FMASK))) {
-      fmask = ac_build_load_to_sgpr(&ctx->ac, ptr,
+
+      fmask = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v8i32, ptr,
                                     LLVMConstInt(ctx->ac.i32, SI_PS_IMAGE_COLORBUF0_FMASK / 2, 0));
 
       ac_apply_fmask_to_sample(&ctx->ac, fmask, args.coords,
@@ -547,7 +549,8 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
 
    /* Load the buffer descriptor. */
    slot = LLVMConstInt(ctx->ac.i32, SI_PS_CONST_POLY_STIPPLE, 0);
-   desc = ac_build_load_to_sgpr(&ctx->ac, param_internal_bindings, slot);
+
+   desc = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v4i32, param_internal_bindings, slot);
 
    /* The stipple pattern is 32x32, each row has 32 bits. */
    offset = LLVMBuildMul(builder, address[1], LLVMConstInt(ctx->ac.i32, 4, 0), "");
index 8cbc8e5..bac1143 100644 (file)
@@ -104,7 +104,10 @@ static LLVMValueRef load_ubo(struct ac_shader_abi *abi, LLVMValueRef index)
    index =
       LLVMBuildAdd(ctx->ac.builder, index, LLVMConstInt(ctx->ac.i32, SI_NUM_SHADER_BUFFERS, 0), "");
 
-   return ac_build_load_to_sgpr(&ctx->ac, ptr, index);
+   return ac_build_load_to_sgpr2(&ctx->ac,
+                                 ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->const_and_shader_buffers),
+                                 ptr,
+                                 index);
 }
 
 static LLVMValueRef load_ssbo(struct ac_shader_abi *abi, LLVMValueRef index, bool write, bool non_uniform)
@@ -117,12 +120,13 @@ static LLVMValueRef load_ssbo(struct ac_shader_abi *abi, LLVMValueRef index, boo
       return ac_get_arg(&ctx->ac, ctx->cs_shaderbuf[LLVMConstIntGetZExtValue(index)]);
 
    LLVMValueRef rsrc_ptr = ac_get_arg(&ctx->ac, ctx->const_and_shader_buffers);
-
    index = si_llvm_bound_index(ctx, index, ctx->num_shader_buffers);
    index = LLVMBuildSub(ctx->ac.builder, LLVMConstInt(ctx->ac.i32, SI_NUM_SHADER_BUFFERS - 1, 0),
                         index, "");
 
-   return ac_build_load_to_sgpr(&ctx->ac, rsrc_ptr, index);
+   return ac_build_load_to_sgpr2(&ctx->ac,
+                                 ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->const_and_shader_buffers),
+                                 rsrc_ptr, index);
 }
 
 /**
@@ -177,7 +181,7 @@ static LLVMValueRef fixup_image_desc(struct si_shader_context *ctx, LLVMValueRef
 
 /* AC_DESC_FMASK is handled exactly like AC_DESC_IMAGE. The caller should
  * adjust "index" to point to FMASK. */
-static LLVMValueRef si_load_image_desc(struct si_shader_context *ctx, LLVMValueRef list,
+static LLVMValueRef si_load_image_desc(struct si_shader_context *ctx, LLVMTypeRef type, LLVMValueRef list,
                                        LLVMValueRef index, enum ac_descriptor_type desc_type,
                                        bool uses_store, bool bindless)
 {
@@ -187,14 +191,15 @@ static LLVMValueRef si_load_image_desc(struct si_shader_context *ctx, LLVMValueR
    if (desc_type == AC_DESC_BUFFER) {
       index = ac_build_imad(&ctx->ac, index, LLVMConstInt(ctx->ac.i32, 2, 0), ctx->ac.i32_1);
       list = LLVMBuildPointerCast(builder, list, ac_array_in_const32_addr_space(ctx->ac.v4i32), "");
+      type = ctx->ac.v4i32;
    } else {
       assert(desc_type == AC_DESC_IMAGE || desc_type == AC_DESC_FMASK);
    }
 
    if (bindless)
-      rsrc = ac_build_load_to_sgpr_uint_wraparound(&ctx->ac, list, index);
+      rsrc = ac_build_load_to_sgpr_uint_wraparound2(&ctx->ac, type, list, index);
    else
-      rsrc = ac_build_load_to_sgpr(&ctx->ac, list, index);
+      rsrc = ac_build_load_to_sgpr2(&ctx->ac, type, list, index);
 
    if (desc_type == AC_DESC_IMAGE)
       rsrc = fixup_image_desc(ctx, rsrc, uses_store);
@@ -205,7 +210,8 @@ static LLVMValueRef si_load_image_desc(struct si_shader_context *ctx, LLVMValueR
 /**
  * Load an image view, fmask view. or sampler state descriptor.
  */
-static LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx, LLVMValueRef list,
+static LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx, LLVMTypeRef list_type,
+                                         LLVMValueRef list,
                                          LLVMValueRef index, enum ac_descriptor_type type)
 {
    LLVMBuilderRef builder = ctx->ac.builder;
@@ -219,6 +225,7 @@ static LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx, LLVMValu
       /* The buffer is in [4:7]. */
       index = ac_build_imad(&ctx->ac, index, LLVMConstInt(ctx->ac.i32, 4, 0), ctx->ac.i32_1);
       list = LLVMBuildPointerCast(builder, list, ac_array_in_const32_addr_space(ctx->ac.v4i32), "");
+      list_type = ctx->ac.v4i32;
       break;
    case AC_DESC_FMASK:
       /* The FMASK is at [8:15]. */
@@ -230,6 +237,7 @@ static LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx, LLVMValu
       index = ac_build_imad(&ctx->ac, index, LLVMConstInt(ctx->ac.i32, 4, 0),
                             LLVMConstInt(ctx->ac.i32, 3, 0));
       list = LLVMBuildPointerCast(builder, list, ac_array_in_const32_addr_space(ctx->ac.v4i32), "");
+      list_type = ctx->ac.v4i32;
       break;
    case AC_DESC_PLANE_0:
    case AC_DESC_PLANE_1:
@@ -240,7 +248,7 @@ static LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx, LLVMValu
       unreachable("Plane descriptor requested in radeonsi.");
    }
 
-   return ac_build_load_to_sgpr(&ctx->ac, list, index);
+   return ac_build_load_to_sgpr2(&ctx->ac, list_type, list, index);
 }
 
 static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned descriptor_set,
@@ -258,6 +266,7 @@ static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned
 
    if (bindless) {
       LLVMValueRef list = ac_get_arg(&ctx->ac, ctx->bindless_samplers_and_images);
+      LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->bindless_samplers_and_images);
 
       /* dynamic_index is the bindless handle */
       if (image) {
@@ -269,7 +278,7 @@ static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned
             dynamic_index = LLVMBuildAdd(ctx->ac.builder, dynamic_index, ctx->ac.i32_1, "");
          }
 
-         return si_load_image_desc(ctx, list, dynamic_index, desc_type, write, true);
+         return si_load_image_desc(ctx, type, list, dynamic_index, desc_type, write, true);
       }
 
       /* Since bindless handle arithmetic can contain an unsigned integer
@@ -280,7 +289,7 @@ static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned
       dynamic_index =
          LLVMBuildMul(ctx->ac.builder, dynamic_index, LLVMConstInt(ctx->ac.i64, 2, 0), "");
       list = ac_build_pointer_add(&ctx->ac, ctx->ac.v8i32, list, dynamic_index);
-      return si_load_sampler_desc(ctx, list, ctx->ac.i32_0, desc_type);
+      return si_load_sampler_desc(ctx, type, list, ctx->ac.i32_0, desc_type);
    }
 
    unsigned num_slots = image ? ctx->num_images : ctx->num_samplers;
@@ -290,6 +299,7 @@ static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned
       const_index = base_index;
 
    LLVMValueRef list = ac_get_arg(&ctx->ac, ctx->samplers_and_images);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->samplers_and_images);
    LLVMValueRef index = LLVMConstInt(ctx->ac.i32, const_index, false);
 
    if (dynamic_index) {
@@ -326,12 +336,12 @@ static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned
       }
       index = LLVMBuildSub(ctx->ac.builder, LLVMConstInt(ctx->ac.i32, SI_NUM_IMAGE_SLOTS - 1, 0),
                            index, "");
-      return si_load_image_desc(ctx, list, index, desc_type, write, false);
+      return si_load_image_desc(ctx, type, list, index, desc_type, write, false);
    }
 
    index = LLVMBuildAdd(ctx->ac.builder, index,
                         LLVMConstInt(ctx->ac.i32, SI_NUM_IMAGE_SLOTS / 2, 0), "");
-   return si_load_sampler_desc(ctx, list, index, desc_type);
+   return si_load_sampler_desc(ctx, type, list, index, desc_type);
 }
 
 void si_llvm_init_resource_callbacks(struct si_shader_context *ctx)
index ce0d34b..f9ddea9 100644 (file)
@@ -168,8 +168,9 @@ static void load_input_vs(struct si_shader_context *ctx, unsigned input_index, L
       vb_desc = ac_get_arg(&ctx->ac, ctx->vb_descriptors[input_index]);
    } else {
       unsigned index = input_index - num_vbos_in_user_sgprs;
-      vb_desc = ac_build_load_to_sgpr(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args.vertex_buffers),
-                                      LLVMConstInt(ctx->ac.i32, index, 0));
+      LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->args.vertex_buffers);
+      vb_desc = ac_build_load_to_sgpr2(&ctx->ac, type, ac_get_arg(&ctx->ac, ctx->args.vertex_buffers),
+                                       LLVMConstInt(ctx->ac.i32, index, 0));
    }
 
    if (ctx->abi.vertex_id_replaced) {
@@ -409,6 +410,7 @@ void si_llvm_emit_streamout(struct si_shader_context *ctx, struct si_shader_outp
       LLVMValueRef so_write_offset[4] = {};
       LLVMValueRef so_buffers[4];
       LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+      LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
 
       for (i = 0; i < 4; i++) {
          if (!so->stride[i])
@@ -416,7 +418,7 @@ void si_llvm_emit_streamout(struct si_shader_context *ctx, struct si_shader_outp
 
          LLVMValueRef offset = LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + i, 0);
 
-         so_buffers[i] = ac_build_load_to_sgpr(&ctx->ac, buf_ptr, offset);
+         so_buffers[i] = ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr, offset);
 
          LLVMValueRef so_offset = ac_get_arg(&ctx->ac, ctx->args.streamout_offset[i]);
          so_offset = LLVMBuildMul(builder, so_offset, LLVMConstInt(ctx->ac.i32, 4, 0), "");
@@ -450,8 +452,9 @@ void si_llvm_clipvertex_to_clipdist(struct si_shader_context *ctx,
    unsigned const_chan;
    LLVMValueRef base_elt;
    LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
+   LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
    LLVMValueRef constbuf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_CLIP_PLANES, 0);
-   LLVMValueRef const_resource = ac_build_load_to_sgpr(&ctx->ac, ptr, constbuf_index);
+   LLVMValueRef const_resource = ac_build_load_to_sgpr2(&ctx->ac, type, ptr, constbuf_index);
    unsigned clipdist_mask = ctx->shader->selector->info.clipdist_mask &
                             ~ctx->shader->key.ge.opt.kill_clip_distances;
 
@@ -816,8 +819,8 @@ void si_llvm_build_vs_exports(struct si_shader_context *ctx, LLVMValueRef num_ex
             LLVMBuildPointerCast(ctx->ac.builder,
                                  ac_get_arg(&ctx->ac, ctx->internal_bindings),
                                  LLVMPointerType(ctx->ac.i32, AC_ADDR_SPACE_CONST_32BIT), "");
-         attr_address = ac_build_load_to_sgpr(&ctx->ac, ptr,
-                                              LLVMConstInt(ctx->ac.i32, SI_GS_ATTRIBUTE_RING * 4, 0));
+         attr_address = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.i32, ptr,
+                                               LLVMConstInt(ctx->ac.i32, SI_GS_ATTRIBUTE_RING * 4, 0));
       } else {
          attr_address = ac_get_arg(&ctx->ac, ctx->gs_attr_address);
       }
@@ -1036,7 +1039,7 @@ void si_llvm_build_vs_prolog(struct si_shader_context *ctx, union si_shader_part
    if (key->vs_prolog.states.instance_divisor_is_fetched) {
       LLVMValueRef list = si_prolog_get_internal_bindings(ctx);
       LLVMValueRef buf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_INSTANCE_DIVISORS, 0);
-      instance_divisor_constbuf = ac_build_load_to_sgpr(&ctx->ac, list, buf_index);
+      instance_divisor_constbuf = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v4i32, list, buf_index);
    }
 
    for (i = 0; i < key->vs_prolog.num_inputs; i++) {