radeonsi: make get_indirect_index globally visible
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sat, 24 Jun 2017 18:08:30 +0000 (20:08 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 31 Jul 2017 12:55:41 +0000 (14:55 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader_internal.h

index 090ec8313ed4034d24d88f42713a7c45df1f09d5..bf66879571a1c08451413e27c5dd8af610f47e9e 100644 (file)
@@ -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, &reg.DimIndirect,
+                       index = si_get_indirect_index(ctx, &reg.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, &reg.Indirect,
+               ind_index = si_get_indirect_index(ctx, &reg.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, &reg.DimIndirect,
+                       vertex_index = si_get_indirect_index(ctx, &reg.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, &reg.Indirect,
+               param_index = si_get_indirect_index(ctx, &reg.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;
index 26d7d09fa207ea273001aec8849f2242c1db26f8..808996adf5c436983de12fb8ce3e1b9ceb5875c6 100644 (file)
@@ -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);