ac: pass the number of channels to ac_build_buffer_load_format()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 10 Jan 2018 19:12:10 +0000 (20:12 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 26 Jan 2018 11:14:27 +0000 (12:14 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/amd/common/ac_llvm_build.c
src/amd/common/ac_llvm_build.h
src/amd/common/ac_nir_to_llvm.c
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

index 705a08ac7ae0a4ddd3f7e9475da46020b871293a..fa2f7f5097eadf96fd7fdd88d59d6c13826210ad 100644 (file)
@@ -1013,20 +1013,12 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
                                         LLVMValueRef rsrc,
                                         LLVMValueRef vindex,
                                         LLVMValueRef voffset,
+                                        unsigned num_channels,
                                         bool can_speculate)
 {
-       LLVMValueRef args [] = {
-               LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
-               vindex,
-               voffset,
-               ctx->i1false, /* glc */
-               ctx->i1false, /* slc */
-       };
-
-       return ac_build_intrinsic(ctx,
-                                 "llvm.amdgcn.buffer.load.format.v4f32",
-                                 ctx->v4f32, args, ARRAY_SIZE(args),
-                                 ac_get_load_intr_attribs(can_speculate));
+       return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset,
+                                          num_channels, false, false,
+                                          can_speculate, true);
 }
 
 /**
index f87889daf6de11660b26980ec223173604e72fa5..0a9053ef92c5ed269970e5abe87c366cec845f2d 100644 (file)
@@ -214,6 +214,7 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
                                         LLVMValueRef rsrc,
                                         LLVMValueRef vindex,
                                         LLVMValueRef voffset,
+                                        unsigned num_channels,
                                         bool can_speculate);
 
 LLVMValueRef
index 7b6d7bca9c1ff80212c34a033e6c0cd2b0872b2f..b40769fe5a0d1d3f0b9988c8fd20435fa0eade4b 100644 (file)
@@ -2319,7 +2319,7 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
                                                   args->resource,
                                                   args->addr,
                                                   ctx->ac.i32_0,
-                                                  true);
+                                                  4, true);
        }
 
        args->opcode = ac_image_sample;
@@ -5361,7 +5361,7 @@ handle_vs_input_decl(struct nir_to_llvm_context *ctx,
                input = ac_build_buffer_load_format(&ctx->ac, t_list,
                                                    buffer_index,
                                                    ctx->ac.i32_0,
-                                                   true);
+                                                   4, true);
 
                for (unsigned chan = 0; chan < 4; chan++) {
                        LLVMValueRef llvm_chan = LLVMConstInt(ctx->ac.i32, chan, false);
index 4717366d07b54b1753860e94ad2557e08fb6d981..8d3e34f91c894ecbd4aa92bd075d263f53cd7598 100644 (file)
@@ -610,7 +610,7 @@ void si_llvm_load_input_vs(
 
                input[i] = ac_build_buffer_load_format(&ctx->ac, t_list,
                                                       vertex_index, voffset,
-                                                      true);
+                                                      4, true);
        }
 
        /* Break up the vec4 into individual components */
index d5c9470974aed688e3d02b737d80f1e94b16aa0f..7bffc26ba6c65cc7b938ee08c5cf3fb3a87944c9 100644 (file)
@@ -1826,7 +1826,7 @@ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
                                                    emit_data->args[0],
                                                    emit_data->args[2],
                                                    emit_data->args[1],
-                                                   true);
+                                                   4, true);
                return;
        }