From: Nicolai Hähnle <nicolai.haeh...@amd.com>

To have the same signature as get_array_range.
---
 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c 
b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 994c7da..531a8fe 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -151,28 +151,29 @@ get_array_range(struct lp_build_tgsi_context *bld_base,
                        return array->range;
        }
 
        range.First = 0;
        range.Last = bld_base->info->file_max[File];
        return range;
 }
 
 static LLVMValueRef get_alloca_for_array(struct lp_build_tgsi_context 
*bld_base,
                                         unsigned file,
-                                        unsigned index)
+                                        unsigned index,
+                                        const struct tgsi_ind_register *reg)
 {
        const struct radeon_llvm_array *array;
 
        if (file != TGSI_FILE_TEMPORARY)
                return NULL;
 
-       array = get_temp_array(bld_base, index, NULL);
+       array = get_temp_array(bld_base, index, reg);
        if (!array)
                return NULL;
 
        return array->alloca;
 }
 
 static LLVMValueRef
 emit_array_index(struct lp_build_tgsi_soa_context *bld,
                 const struct tgsi_ind_register *reg,
                 unsigned offset)
@@ -240,21 +241,21 @@ load_value_from_array(struct lp_build_tgsi_context 
*bld_base,
                      enum tgsi_opcode_type type,
                      unsigned swizzle,
                      unsigned reg_index,
                      const struct tgsi_ind_register *reg_indirect)
 {
        struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
        struct gallivm_state *gallivm = bld_base->base.gallivm;
        LLVMBuilderRef builder = gallivm->builder;
        struct tgsi_declaration_range range = get_array_range(bld_base, file, 
reg_index, reg_indirect);
        LLVMValueRef index = emit_array_index(bld, reg_indirect, reg_index - 
range.First);
-       LLVMValueRef array = get_alloca_for_array(bld_base, file, reg_index);
+       LLVMValueRef array = get_alloca_for_array(bld_base, file, reg_index, 
reg_indirect);
        LLVMValueRef ptr, val, indices[2];
 
        if (!array) {
                /* Handle the case where the array is stored as a vector. */
                return LLVMBuildExtractElement(builder,
                                emit_array_fetch(bld_base, file, type, range, 
swizzle),
                                index, "");
        }
 
        index = LLVMBuildMul(builder, index, lp_build_const_int32(gallivm, 
TGSI_NUM_CHANNELS), "");
@@ -280,21 +281,21 @@ store_value_to_array(struct lp_build_tgsi_context 
*bld_base,
                     unsigned file,
                     unsigned chan_index,
                     unsigned reg_index,
                     const struct tgsi_ind_register *reg_indirect)
 {
        struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
        struct gallivm_state *gallivm = bld_base->base.gallivm;
        LLVMBuilderRef builder = gallivm->builder;
        struct tgsi_declaration_range range = get_array_range(bld_base, file, 
reg_index, reg_indirect);
        LLVMValueRef index = emit_array_index(bld, reg_indirect, reg_index - 
range.First);
-       LLVMValueRef array = get_alloca_for_array(bld_base, file, reg_index);
+       LLVMValueRef array = get_alloca_for_array(bld_base, file, reg_index, 
reg_indirect);
 
        if (array) {
                LLVMValueRef indices[2];
                index = LLVMBuildMul(builder, index, 
lp_build_const_int32(gallivm, TGSI_NUM_CHANNELS), "");
                index = LLVMBuildAdd(builder, index, 
lp_build_const_int32(gallivm, chan_index), "");
                indices[0] = bld_base->uint_bld.zero;
                indices[1] = index;
                LLVMValueRef pointer = LLVMBuildGEP(builder, array, indices, 2, 
"");
                LLVMBuildStore(builder, value, pointer);
                return NULL;
@@ -617,21 +618,21 @@ void radeon_llvm_emit_store(struct lp_build_tgsi_context 
*bld_base,
 
                if (reg->Register.Indirect) {
                        struct tgsi_declaration_range range = 
get_array_range(bld_base,
                                reg->Register.File, reg->Register.Index, 
&reg->Indirect);
 
                        unsigned i, size = range.Last - range.First + 1;
                        unsigned file = reg->Register.File;
                        unsigned reg_index = reg->Register.Index;
                        LLVMValueRef array = store_value_to_array(bld_base, 
value, file, chan_index,
                                                                  reg_index, 
&reg->Indirect);
-                       if (get_alloca_for_array(bld_base, file, reg_index)) {
+                       if (get_alloca_for_array(bld_base, file, reg_index, 
&reg->Indirect)) {
                                continue;
                        }
                        for (i = 0; i < size; ++i) {
                                switch(reg->Register.File) {
                                case TGSI_FILE_OUTPUT:
                                        temp_ptr = bld->outputs[i + 
range.First][chan_index];
                                        break;
 
                                case TGSI_FILE_TEMPORARY:
                                        if (range.First + i >= ctx->temps_count)
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to