From 6bba95607370a6be2482105e9030471ceea96944 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Wed, 10 Aug 2016 18:50:24 +0200 Subject: [PATCH] gallium/radeon: use tgsi_scan_arrays for temp arrays MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/gallium/drivers/radeon/radeon_llvm.h | 3 ++- src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 9 ++++++--- src/gallium/drivers/radeonsi/si_shader.c | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h index 6086dd6864a..4ed2c97936f 100644 --- a/src/gallium/drivers/radeon/radeon_llvm.h +++ b/src/gallium/drivers/radeon/radeon_llvm.h @@ -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, diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c index 25210236467..dac0594cfbd 100644 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c @@ -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; diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index c595ee00482..06b5c9c2c48 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -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) -- 2.30.2