gallium/radeon: use tgsi_scan_arrays for temp arrays
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 10 Aug 2016 16:50:24 +0000 (18:50 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 17 Aug 2016 10:11:23 +0000 (12:11 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/radeon_llvm.h
src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
src/gallium/drivers/radeonsi/si_shader.c

index 6086dd6864adf77d3d4e627dad6f4da024239345..4ed2c97936f3d661ede887d7ce653fa470644575 100644 (file)
@@ -121,7 +121,8 @@ void radeon_llvm_emit_prepare_cube_coords(struct lp_build_tgsi_context *bld_base
 
 void radeon_llvm_context_init(struct radeon_llvm_context *ctx,
                               const char *triple,
-                             const struct tgsi_shader_info *info);
+                             const struct tgsi_shader_info *info,
+                             const struct tgsi_token *tokens);
 
 void radeon_llvm_create_func(struct radeon_llvm_context *ctx,
                             LLVMTypeRef *return_types, unsigned num_return_elems,
index 25210236467d1f2e91d82e437efd485a1c28be52..dac0594cfbd7f7cfe62df845c7a84b5d71ef9b5e 100644 (file)
@@ -485,8 +485,6 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
                if (decl->Declaration.Array) {
                        unsigned id = decl->Array.ArrayID - 1;
 
-                       ctx->temp_arrays[id].range = decl->Range;
-
                        /* If the array has more than 16 elements, store it
                         * in memory using an alloca that spans the entire
                         * array.
@@ -1730,7 +1728,8 @@ static void emit_rsq(const struct lp_build_tgsi_action *action,
 }
 
 void radeon_llvm_context_init(struct radeon_llvm_context *ctx, const char *triple,
-                             const struct tgsi_shader_info *info)
+                             const struct tgsi_shader_info *info,
+                             const struct tgsi_token *tokens)
 {
        struct lp_type type;
 
@@ -1756,6 +1755,10 @@ void radeon_llvm_context_init(struct radeon_llvm_context *ctx, const char *tripl
 
                ctx->temp_arrays = CALLOC(size, sizeof(ctx->temp_arrays[0]));
                ctx->temp_array_allocas = CALLOC(size, sizeof(ctx->temp_array_allocas[0]));
+
+               if (tokens)
+                       tgsi_scan_arrays(tokens, TGSI_FILE_TEMPORARY, size,
+                                        ctx->temp_arrays);
        }
 
        type.floating = true;
index c595ee00482a55250fd01ba461296f5d51e94916..06b5c9c2c4876258933378a6ea18123259d73d63 100644 (file)
@@ -6524,7 +6524,8 @@ static void si_init_shader_ctx(struct si_shader_context *ctx,
        memset(ctx, 0, sizeof(*ctx));
        radeon_llvm_context_init(
                &ctx->radeon_bld, "amdgcn--",
-               (shader && shader->selector) ? &shader->selector->info : NULL);
+               (shader && shader->selector) ? &shader->selector->info : NULL,
+               (shader && shader->selector) ? shader->selector->tokens : NULL);
        ctx->tm = tm;
        ctx->screen = sscreen;
        if (shader && shader->selector)