summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-08-10 18:50:24 +0200
committerNicolai Hähnle <[email protected]>2016-08-17 12:11:23 +0200
commit6bba95607370a6be2482105e9030471ceea96944 (patch)
tree1ac3bac7b0b0daab98295e2c1bfa6b8ad5810e2a
parent7c2295d7efba2178c22e0caf9d9166db81ea7329 (diff)
gallium/radeon: use tgsi_scan_arrays for temp arrays
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm.h3
-rw-r--r--src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c9
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c3
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)