From: Marek Olšák Date: Wed, 7 Aug 2019 02:51:56 +0000 (-0400) Subject: radeonsi: clean up si_llvm_context_set_tgsi X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f8a66174836a0207d97392283ed08e4d1627b03;p=mesa.git radeonsi: clean up si_llvm_context_set_tgsi Reviewed-by: Pierre-Eric Pelloux-Prayer --- diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index a16a4a5557e..f7087c1adca 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6956,7 +6956,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, } si_init_shader_ctx(&ctx, sscreen, compiler, si_get_shader_wave_size(shader)); - si_llvm_context_set_tgsi(&ctx, shader); + si_llvm_context_set_ir(&ctx, shader); memset(shader->info.vs_output_param_offset, AC_EXP_PARAM_UNDEFINED, sizeof(shader->info.vs_output_param_offset)); @@ -7013,7 +7013,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, shader_ls.key.mono = shader->key.mono; shader_ls.key.opt = shader->key.opt; shader_ls.is_monolithic = true; - si_llvm_context_set_tgsi(&ctx, &shader_ls); + si_llvm_context_set_ir(&ctx, &shader_ls); if (!si_compile_tgsi_main(&ctx)) { si_llvm_dispose(&ctx); @@ -7080,7 +7080,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, shader_es.key.mono = shader->key.mono; shader_es.key.opt = shader->key.opt; shader_es.is_monolithic = true; - si_llvm_context_set_tgsi(&ctx, &shader_es); + si_llvm_context_set_ir(&ctx, &shader_es); if (!si_compile_tgsi_main(&ctx)) { si_llvm_dispose(&ctx); diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index ae99bf5d374..5887d2632d7 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -280,8 +280,8 @@ void si_llvm_context_init(struct si_shader_context *ctx, struct si_screen *sscreen, struct ac_llvm_compiler *compiler, unsigned wave_size); -void si_llvm_context_set_tgsi(struct si_shader_context *ctx, - struct si_shader *shader); +void si_llvm_context_set_ir(struct si_shader_context *ctx, + struct si_shader *shader); void si_llvm_create_func(struct si_shader_context *ctx, const char *name, diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index c5f400d8791..e51250c2dac 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -1033,19 +1033,14 @@ void si_llvm_context_init(struct si_shader_context *ctx, /* Set the context to a certain TGSI shader. Can be called repeatedly * to change the shader. */ -void si_llvm_context_set_tgsi(struct si_shader_context *ctx, - struct si_shader *shader) +void si_llvm_context_set_ir(struct si_shader_context *ctx, + struct si_shader *shader) { - const struct tgsi_shader_info *info = NULL; - const struct tgsi_token *tokens = NULL; - - if (shader && shader->selector) { - info = &shader->selector->info; - tokens = shader->selector->tokens; - } + struct si_shader_selector *sel = shader->selector; + const struct tgsi_shader_info *info = &sel->info; ctx->shader = shader; - ctx->type = info ? info->processor : -1; + ctx->type = sel->type; ctx->bld_base.info = info; /* Clean up the old contents. */ @@ -1062,16 +1057,13 @@ void si_llvm_context_set_tgsi(struct si_shader_context *ctx, ctx->temps = NULL; ctx->temps_count = 0; - if (!info) - return; - ctx->num_const_buffers = util_last_bit(info->const_buffers_declared); ctx->num_shader_buffers = util_last_bit(info->shader_buffers_declared); ctx->num_samplers = util_last_bit(info->samplers_declared); ctx->num_images = util_last_bit(info->images_declared); - if (!tokens) + if (sel->nir) return; if (info->array_max[TGSI_FILE_TEMPORARY] > 0) { @@ -1080,7 +1072,7 @@ void si_llvm_context_set_tgsi(struct si_shader_context *ctx, ctx->temp_arrays = CALLOC(size, sizeof(ctx->temp_arrays[0])); ctx->temp_array_allocas = CALLOC(size, sizeof(ctx->temp_array_allocas[0])); - tgsi_scan_arrays(tokens, TGSI_FILE_TEMPORARY, size, + tgsi_scan_arrays(sel->tokens, TGSI_FILE_TEMPORARY, size, ctx->temp_arrays); } if (info->file_max[TGSI_FILE_IMMEDIATE] >= 0) {