From d46018a4d792dbe0c1ba6a74cbd386e378dc6067 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 24 Jun 2017 20:08:30 +0200 Subject: [PATCH] radeonsi: make get_indirect_index globally visible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader.c | 20 +++++++++---------- .../drivers/radeonsi/si_shader_internal.h | 3 +++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 090ec8313ed..bf66879571a 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -652,9 +652,9 @@ static LLVMValueRef get_primitive_id(struct si_shader_context *ctx, * Return the value of tgsi_ind_register for indexing. * This is the indirect index with the constant offset added to it. */ -static LLVMValueRef get_indirect_index(struct si_shader_context *ctx, - const struct tgsi_ind_register *ind, - int rel_index) +LLVMValueRef si_get_indirect_index(struct si_shader_context *ctx, + const struct tgsi_ind_register *ind, + int rel_index) { struct gallivm_state *gallivm = &ctx->gallivm; LLVMValueRef result; @@ -667,14 +667,14 @@ static LLVMValueRef get_indirect_index(struct si_shader_context *ctx, } /** - * Like get_indirect_index, but restricts the return value to a (possibly + * Like si_get_indirect_index, but restricts the return value to a (possibly * undefined) value inside [0..num). */ LLVMValueRef si_get_bounded_indirect_index(struct si_shader_context *ctx, const struct tgsi_ind_register *ind, int rel_index, unsigned num) { - LLVMValueRef result = get_indirect_index(ctx, ind, rel_index); + LLVMValueRef result = si_get_indirect_index(ctx, ind, rel_index); return si_llvm_bound_index(ctx, result, num); } @@ -714,7 +714,7 @@ static LLVMValueRef get_dw_address(struct si_shader_context *ctx, LLVMValueRef index; if (reg.Dimension.Indirect) - index = get_indirect_index(ctx, ®.DimIndirect, + index = si_get_indirect_index(ctx, ®.DimIndirect, reg.Dimension.Index); else index = LLVMConstInt(ctx->i32, reg.Dimension.Index, 0); @@ -747,7 +747,7 @@ static LLVMValueRef get_dw_address(struct si_shader_context *ctx, else first = reg.Register.Index; - ind_index = get_indirect_index(ctx, ®.Indirect, + ind_index = si_get_indirect_index(ctx, ®.Indirect, reg.Register.Index - first); base_addr = LLVMBuildAdd(gallivm->builder, base_addr, @@ -850,7 +850,7 @@ static LLVMValueRef get_tcs_tes_buffer_address_from_reg( if (reg.Register.Dimension) { if (reg.Dimension.Indirect) - vertex_index = get_indirect_index(ctx, ®.DimIndirect, + vertex_index = si_get_indirect_index(ctx, ®.DimIndirect, reg.Dimension.Index); else vertex_index = LLVMConstInt(ctx->i32, reg.Dimension.Index, 0); @@ -876,7 +876,7 @@ static LLVMValueRef get_tcs_tes_buffer_address_from_reg( else param_base = reg.Register.Index; - param_index = get_indirect_index(ctx, ®.Indirect, + param_index = si_get_indirect_index(ctx, ®.Indirect, reg.Register.Index - param_base); } else { @@ -3674,7 +3674,7 @@ static void build_interp_intrinsic(const struct lp_build_tgsi_action *action, input_array_size = info->num_inputs - input_base; } - array_idx = get_indirect_index(ctx, &input->Indirect, + array_idx = si_get_indirect_index(ctx, &input->Indirect, input->Register.Index - input_base); } else { input_base = inst->Src[0].Register.Index; diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index 26d7d09fa20..808996adf5c 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -305,6 +305,9 @@ void si_llvm_emit_store(struct lp_build_tgsi_context *bld_base, void si_emit_waitcnt(struct si_shader_context *ctx, unsigned simm16); +LLVMValueRef si_get_indirect_index(struct si_shader_context *ctx, + const struct tgsi_ind_register *ind, + int rel_index); LLVMValueRef si_get_bounded_indirect_index(struct si_shader_context *ctx, const struct tgsi_ind_register *ind, int rel_index, unsigned num); -- 2.30.2