summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-12-31 23:35:59 +0100
committerMarek Olšák <[email protected]>2018-01-27 02:09:09 +0100
commitb633999a4e765230701c98957364814c7f4f042b (patch)
tree57395d0aa00823fc58cb4646dd4e630a4b38ad45 /src/gallium
parente17eb8800f3c4255f55b33af53336bd29dbcfa77 (diff)
ac: rename and move si_const_array into common code
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c19
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_internal.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c6
3 files changed, 9 insertions, 18 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index b75dab7cfbb..b18b4f63b86 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3945,12 +3945,6 @@ static void clock_emit(
LLVMBuildExtractElement(ctx->ac.builder, tmp, ctx->i32_1, "");
}
-LLVMTypeRef si_const_array(LLVMTypeRef elem_type, int num_elements)
-{
- return LLVMPointerType(LLVMArrayType(elem_type, num_elements),
- AC_CONST_ADDR_SPACE);
-}
-
static void si_llvm_emit_ddxy(
const struct lp_build_tgsi_action *action,
struct lp_build_tgsi_context *bld_base,
@@ -4562,12 +4556,11 @@ static void declare_per_stage_desc_pointers(struct si_shader_context *ctx,
unsigned const_and_shader_buffers =
add_arg(fninfo, ARG_SGPR,
- si_const_array(const_shader_buf_type, 0));
+ ac_array_in_const_addr_space(const_shader_buf_type));
unsigned samplers_and_images =
add_arg(fninfo, ARG_SGPR,
- si_const_array(ctx->v8i32,
- SI_NUM_IMAGES + SI_NUM_SAMPLERS * 2));
+ ac_array_in_const_addr_space(ctx->v8i32));
if (assign_params) {
ctx->param_const_and_shader_buffers = const_and_shader_buffers;
@@ -4579,16 +4572,16 @@ static void declare_global_desc_pointers(struct si_shader_context *ctx,
struct si_function_info *fninfo)
{
ctx->param_rw_buffers = add_arg(fninfo, ARG_SGPR,
- si_const_array(ctx->v4i32, SI_NUM_RW_BUFFERS));
+ ac_array_in_const_addr_space(ctx->v4i32));
ctx->param_bindless_samplers_and_images = add_arg(fninfo, ARG_SGPR,
- si_const_array(ctx->v8i32, 0));
+ ac_array_in_const_addr_space(ctx->v8i32));
}
static void declare_vs_specific_input_sgprs(struct si_shader_context *ctx,
struct si_function_info *fninfo)
{
ctx->param_vertex_buffers = add_arg(fninfo, ARG_SGPR,
- si_const_array(ctx->v4i32, SI_NUM_VERTEX_BUFFERS));
+ ac_array_in_const_addr_space(ctx->v4i32));
add_arg_assign(fninfo, ARG_SGPR, ctx->i32, &ctx->abi.base_vertex);
add_arg_assign(fninfo, ARG_SGPR, ctx->i32, &ctx->abi.start_instance);
add_arg_assign(fninfo, ARG_SGPR, ctx->i32, &ctx->abi.draw_id);
@@ -7083,7 +7076,7 @@ static LLVMValueRef si_prolog_get_rw_buffers(struct si_shader_context *ctx)
list = lp_build_gather_values(&ctx->gallivm, ptr, 2);
list = LLVMBuildBitCast(ctx->ac.builder, list, ctx->i64, "");
list = LLVMBuildIntToPtr(ctx->ac.builder, list,
- si_const_array(ctx->v4i32, SI_NUM_RW_BUFFERS), "");
+ ac_array_in_const_addr_space(ctx->v4i32), "");
return list;
}
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 7306481ccd9..3084d88fad6 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -310,8 +310,6 @@ LLVMValueRef si_get_bounded_indirect_index(struct si_shader_context *ctx,
const struct tgsi_ind_register *ind,
int rel_index, unsigned num);
-LLVMTypeRef si_const_array(LLVMTypeRef elem_type, int num_elements);
-
void si_shader_context_init_alu(struct lp_build_tgsi_context *bld_base);
void si_shader_context_init_mem(struct si_shader_context *ctx);
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 7bffc26ba6c..c80dc8ef0ee 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -140,7 +140,7 @@ LLVMValueRef si_load_image_desc(struct si_shader_context *ctx,
index = LLVMBuildAdd(builder, index,
ctx->i32_1, "");
list = LLVMBuildPointerCast(builder, list,
- si_const_array(ctx->v4i32, 0), "");
+ ac_array_in_const_addr_space(ctx->v4i32), "");
} else {
assert(desc_type == AC_DESC_IMAGE);
}
@@ -1102,7 +1102,7 @@ LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx,
index = LLVMBuildMul(builder, index, LLVMConstInt(ctx->i32, 4, 0), "");
index = LLVMBuildAdd(builder, index, ctx->i32_1, "");
list = LLVMBuildPointerCast(builder, list,
- si_const_array(ctx->v4i32, 0), "");
+ ac_array_in_const_addr_space(ctx->v4i32), "");
break;
case AC_DESC_FMASK:
/* The FMASK is at [8:15]. */
@@ -1114,7 +1114,7 @@ LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx,
index = LLVMBuildMul(builder, index, LLVMConstInt(ctx->i32, 4, 0), "");
index = LLVMBuildAdd(builder, index, LLVMConstInt(ctx->i32, 3, 0), "");
list = LLVMBuildPointerCast(builder, list,
- si_const_array(ctx->v4i32, 0), "");
+ ac_array_in_const_addr_space(ctx->v4i32), "");
break;
}