diff options
author | Marek Olšák <[email protected]> | 2018-04-09 18:26:05 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-04-27 17:56:04 -0400 |
commit | 87eb597758a1fe126a712675e8f15c4395c57143 (patch) | |
tree | 41b2383ccd3034827a0fa583c7a01b6e54f83ec1 /src/gallium/drivers/radeonsi/si_shader.c | |
parent | 788d66553af418d3a195b58c3debd87a40f8174c (diff) |
radeonsi: add struct si_compiler containing LLVMTargetMachineRef
It will contain more variables.
Reviewed-by: Timothy Arceri <[email protected]>
Tested-by: Benedikt Schemmer <ben at besd.de>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 9c27c5a0b3e..e8d08cd8e7f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -77,7 +77,7 @@ enum si_arg_regfile { static void si_init_shader_ctx(struct si_shader_context *ctx, struct si_screen *sscreen, - LLVMTargetMachineRef tm); + struct si_compiler *compiler); static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action, struct lp_build_tgsi_context *bld_base, @@ -5640,7 +5640,7 @@ void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader, static int si_compile_llvm(struct si_screen *sscreen, struct ac_shader_binary *binary, struct si_shader_config *conf, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, LLVMModuleRef mod, struct pipe_debug_callback *debug, unsigned processor, @@ -5666,7 +5666,7 @@ static int si_compile_llvm(struct si_screen *sscreen, } if (!si_replace_shader(count, binary)) { - r = si_llvm_compile(mod, binary, tm, debug); + r = si_llvm_compile(mod, binary, compiler, debug); if (r) return r; } @@ -5718,7 +5718,7 @@ static void si_llvm_build_ret(struct si_shader_context *ctx, LLVMValueRef ret) /* Generate code for the hardware VS shader stage to go with a geometry shader */ struct si_shader * si_generate_gs_copy_shader(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader_selector *gs_selector, struct pipe_debug_callback *debug) { @@ -5749,7 +5749,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen, shader->selector = gs_selector; shader->is_gs_copy_shader = true; - si_init_shader_ctx(&ctx, sscreen, tm); + si_init_shader_ctx(&ctx, sscreen, compiler); ctx.shader = shader; ctx.type = PIPE_SHADER_VERTEX; @@ -5844,7 +5844,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen, si_llvm_optimize_module(&ctx); r = si_compile_llvm(sscreen, &ctx.shader->binary, - &ctx.shader->config, ctx.tm, + &ctx.shader->config, ctx.compiler, ctx.gallivm.module, debug, PIPE_SHADER_GEOMETRY, "GS Copy Shader"); @@ -5966,11 +5966,11 @@ static void si_dump_shader_key(unsigned processor, const struct si_shader *shade static void si_init_shader_ctx(struct si_shader_context *ctx, struct si_screen *sscreen, - LLVMTargetMachineRef tm) + struct si_compiler *compiler) { struct lp_build_tgsi_context *bld_base; - si_llvm_context_init(ctx, sscreen, tm); + si_llvm_context_init(ctx, sscreen, compiler); bld_base = &ctx->bld_base; bld_base->emit_fetch_funcs[TGSI_FILE_CONSTANT] = fetch_constant; @@ -6748,7 +6748,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx, } int si_compile_tgsi_shader(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader *shader, bool is_monolithic, struct pipe_debug_callback *debug) @@ -6768,7 +6768,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, si_dump_streamout(&sel->so); } - si_init_shader_ctx(&ctx, sscreen, tm); + si_init_shader_ctx(&ctx, sscreen, compiler); si_llvm_context_set_tgsi(&ctx, shader); ctx.separate_prolog = !is_monolithic; @@ -6978,7 +6978,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, LLVMPointerTypeKind); /* Compile to bytecode. */ - r = si_compile_llvm(sscreen, &shader->binary, &shader->config, tm, + r = si_compile_llvm(sscreen, &shader->binary, &shader->config, compiler, ctx.gallivm.module, debug, ctx.type, "TGSI shader"); si_llvm_dispose(&ctx); if (r) { @@ -7089,7 +7089,7 @@ si_get_shader_part(struct si_screen *sscreen, enum pipe_shader_type type, bool prolog, union si_shader_part_key *key, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct pipe_debug_callback *debug, void (*build)(struct si_shader_context *, union si_shader_part_key *), @@ -7114,7 +7114,7 @@ si_get_shader_part(struct si_screen *sscreen, struct si_shader shader = {}; struct si_shader_context ctx; - si_init_shader_ctx(&ctx, sscreen, tm); + si_init_shader_ctx(&ctx, sscreen, compiler); ctx.shader = &shader; ctx.type = type; @@ -7145,7 +7145,7 @@ si_get_shader_part(struct si_screen *sscreen, /* Compile. */ si_llvm_optimize_module(&ctx); - if (si_compile_llvm(sscreen, &result->binary, &result->config, tm, + if (si_compile_llvm(sscreen, &result->binary, &result->config, compiler, ctx.ac.module, debug, ctx.type, name)) { FREE(result); result = NULL; @@ -7335,7 +7335,7 @@ static void si_build_vs_prolog_function(struct si_shader_context *ctx, } static bool si_get_vs_prolog(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader *shader, struct pipe_debug_callback *debug, struct si_shader *main_part, @@ -7353,7 +7353,7 @@ static bool si_get_vs_prolog(struct si_screen *sscreen, shader->prolog = si_get_shader_part(sscreen, &sscreen->vs_prologs, - PIPE_SHADER_VERTEX, true, &prolog_key, tm, + PIPE_SHADER_VERTEX, true, &prolog_key, compiler, debug, si_build_vs_prolog_function, "Vertex Shader Prolog"); return shader->prolog != NULL; @@ -7363,11 +7363,11 @@ static bool si_get_vs_prolog(struct si_screen *sscreen, * Select and compile (or reuse) vertex shader parts (prolog & epilog). */ static bool si_shader_select_vs_parts(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader *shader, struct pipe_debug_callback *debug) { - return si_get_vs_prolog(sscreen, tm, shader, debug, shader, + return si_get_vs_prolog(sscreen, compiler, shader, debug, shader, &shader->key.part.vs.prolog); } @@ -7452,7 +7452,7 @@ static void si_build_tcs_epilog_function(struct si_shader_context *ctx, * Select and compile (or reuse) TCS parts (epilog). */ static bool si_shader_select_tcs_parts(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader *shader, struct pipe_debug_callback *debug) { @@ -7460,7 +7460,7 @@ static bool si_shader_select_tcs_parts(struct si_screen *sscreen, struct si_shader *ls_main_part = shader->key.part.tcs.ls->main_shader_part_ls; - if (!si_get_vs_prolog(sscreen, tm, shader, debug, ls_main_part, + if (!si_get_vs_prolog(sscreen, compiler, shader, debug, ls_main_part, &shader->key.part.tcs.ls_prolog)) return false; @@ -7474,7 +7474,7 @@ static bool si_shader_select_tcs_parts(struct si_screen *sscreen, shader->epilog = si_get_shader_part(sscreen, &sscreen->tcs_epilogs, PIPE_SHADER_TESS_CTRL, false, - &epilog_key, tm, debug, + &epilog_key, compiler, debug, si_build_tcs_epilog_function, "Tessellation Control Shader Epilog"); return shader->epilog != NULL; @@ -7484,7 +7484,7 @@ static bool si_shader_select_tcs_parts(struct si_screen *sscreen, * Select and compile (or reuse) GS parts (prolog). */ static bool si_shader_select_gs_parts(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader *shader, struct pipe_debug_callback *debug) { @@ -7493,7 +7493,7 @@ static bool si_shader_select_gs_parts(struct si_screen *sscreen, shader->key.part.gs.es->main_shader_part_es; if (shader->key.part.gs.es->type == PIPE_SHADER_VERTEX && - !si_get_vs_prolog(sscreen, tm, shader, debug, es_main_part, + !si_get_vs_prolog(sscreen, compiler, shader, debug, es_main_part, &shader->key.part.gs.vs_prolog)) return false; @@ -7509,7 +7509,7 @@ static bool si_shader_select_gs_parts(struct si_screen *sscreen, shader->prolog2 = si_get_shader_part(sscreen, &sscreen->gs_prologs, PIPE_SHADER_GEOMETRY, true, - &prolog_key, tm, debug, + &prolog_key, compiler, debug, si_build_gs_prolog_function, "Geometry Shader Prolog"); return shader->prolog2 != NULL; @@ -7897,7 +7897,7 @@ static void si_build_ps_epilog_function(struct si_shader_context *ctx, * Select and compile (or reuse) pixel shader parts (prolog & epilog). */ static bool si_shader_select_ps_parts(struct si_screen *sscreen, - LLVMTargetMachineRef tm, + struct si_compiler *compiler, struct si_shader *shader, struct pipe_debug_callback *debug) { @@ -7912,7 +7912,7 @@ static bool si_shader_select_ps_parts(struct si_screen *sscreen, shader->prolog = si_get_shader_part(sscreen, &sscreen->ps_prologs, PIPE_SHADER_FRAGMENT, true, - &prolog_key, tm, debug, + &prolog_key, compiler, debug, si_build_ps_prolog_function, "Fragment Shader Prolog"); if (!shader->prolog) @@ -7925,7 +7925,7 @@ static bool si_shader_select_ps_parts(struct si_screen *sscreen, shader->epilog = si_get_shader_part(sscreen, &sscreen->ps_epilogs, PIPE_SHADER_FRAGMENT, false, - &epilog_key, tm, debug, + &epilog_key, compiler, debug, si_build_ps_epilog_function, "Fragment Shader Epilog"); if (!shader->epilog) @@ -8028,7 +8028,7 @@ static void si_fix_resource_usage(struct si_screen *sscreen, } } -int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, +int si_shader_create(struct si_screen *sscreen, struct si_compiler *compiler, struct si_shader *shader, struct pipe_debug_callback *debug) { @@ -8046,7 +8046,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, /* Monolithic shader (compiled as a whole, has many variants, * may take a long time to compile). */ - r = si_compile_tgsi_shader(sscreen, tm, shader, true, debug); + r = si_compile_tgsi_shader(sscreen, compiler, shader, true, debug); if (r) return r; } else { @@ -8086,21 +8086,21 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, /* Select prologs and/or epilogs. */ switch (sel->type) { case PIPE_SHADER_VERTEX: - if (!si_shader_select_vs_parts(sscreen, tm, shader, debug)) + if (!si_shader_select_vs_parts(sscreen, compiler, shader, debug)) return -1; break; case PIPE_SHADER_TESS_CTRL: - if (!si_shader_select_tcs_parts(sscreen, tm, shader, debug)) + if (!si_shader_select_tcs_parts(sscreen, compiler, shader, debug)) return -1; break; case PIPE_SHADER_TESS_EVAL: break; case PIPE_SHADER_GEOMETRY: - if (!si_shader_select_gs_parts(sscreen, tm, shader, debug)) + if (!si_shader_select_gs_parts(sscreen, compiler, shader, debug)) return -1; break; case PIPE_SHADER_FRAGMENT: - if (!si_shader_select_ps_parts(sscreen, tm, shader, debug)) + if (!si_shader_select_ps_parts(sscreen, compiler, shader, debug)) return -1; /* Make sure we have at least as many VGPRs as there |