gallium/radeon: use tgsi_scan_arrays for temp arrays

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2016-08-10 18:50:24 +02:00
parent 7c2295d7ef
commit 6bba956073
3 changed files with 10 additions and 5 deletions

View 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,

View 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;

View 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)