mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
radeonsi: clean up si_llvm_context_set_tgsi
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
parent
43f8b5642b
commit
1f8a661748
3 changed files with 12 additions and 20 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue