radeonsi: use ac_build_buffer_load_format for image buffer loads
authorMarek Olšák <marek.olsak@amd.com>
Tue, 30 Jan 2018 18:40:43 +0000 (19:40 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 1 Feb 2018 15:20:19 +0000 (16:20 +0100)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

index d89907e11765a054812ed40acbe4391e04f998f4..84d483abe29cb19a025ad58012e7466c5bda27cc 100644 (file)
@@ -566,11 +566,17 @@ static void load_emit(
        }
 
        if (inst->Memory.Texture == TGSI_TEXTURE_BUFFER) {
+               unsigned num_channels = util_last_bit(inst->Dst[0].Register.WriteMask);
+               LLVMValueRef result =
+                       ac_build_buffer_load_format(&ctx->ac,
+                                                   emit_data->args[0],
+                                                   emit_data->args[1],
+                                                   emit_data->args[2],
+                                                   num_channels,
+                                                   LLVMConstIntGetZExtValue(emit_data->args[3]),
+                                                   can_speculate);
                emit_data->output[emit_data->chan] =
-                       lp_build_intrinsic(
-                               builder, "llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type,
-                               emit_data->args, emit_data->arg_count,
-                               ac_get_load_intr_attribs(can_speculate));
+                       ac_build_expand_to_vec4(&ctx->ac, result, num_channels);
        } else {
                ac_get_image_intr_name("llvm.amdgcn.image.load",
                                       emit_data->dst_type,             /* vdata */