diff options
author | Nicolai Hähnle <[email protected]> | 2016-10-28 21:31:27 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-11-03 10:07:14 +0100 |
commit | 06dcb2d2a946bf83a27c8f9efb5f0a210606fe2d (patch) | |
tree | d2be052c217be4826edebf8949f313ffc7b351bb /src/gallium/drivers/radeonsi | |
parent | f9daa2f470b323d3803e729ca42c08c49f608504 (diff) |
radeonsi: use VS prolog and epilog for monolithic shaders
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 226c33506e9..7272313554a 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -71,6 +71,10 @@ static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action, static void si_dump_shader_key(unsigned shader, union si_shader_key *key, FILE *f); +static void si_build_vs_prolog_function(struct si_shader_context *ctx, + union si_shader_part_key *key); +static void si_build_vs_epilog_function(struct si_shader_context *ctx, + union si_shader_part_key *key); static void si_build_ps_prolog_function(struct si_shader_context *ctx, union si_shader_part_key *key); static void si_build_ps_epilog_function(struct si_shader_context *ctx, @@ -7174,7 +7178,8 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, ctx.no_epilog = is_monolithic; ctx.separate_prolog = !is_monolithic; - if (ctx.type == PIPE_SHADER_FRAGMENT) { + if (ctx.type == PIPE_SHADER_VERTEX || + ctx.type == PIPE_SHADER_FRAGMENT) { ctx.no_prolog = false; ctx.no_epilog = false; } @@ -7192,7 +7197,33 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, return -1; } - if (is_monolithic && ctx.type == PIPE_SHADER_FRAGMENT) { + if (is_monolithic && ctx.type == PIPE_SHADER_VERTEX) { + LLVMValueRef parts[3]; + bool need_prolog; + bool need_epilog; + + need_prolog = sel->info.num_inputs; + need_epilog = !shader->key.vs.as_es && !shader->key.vs.as_ls; + + parts[need_prolog ? 1 : 0] = ctx.main_fn; + + if (need_prolog) { + union si_shader_part_key prolog_key; + si_get_vs_prolog_key(shader, &prolog_key); + si_build_vs_prolog_function(&ctx, &prolog_key); + parts[0] = ctx.main_fn; + } + + if (need_epilog) { + union si_shader_part_key epilog_key; + si_get_vs_epilog_key(shader, &shader->key.vs.epilog, &epilog_key); + si_build_vs_epilog_function(&ctx, &epilog_key); + parts[need_prolog ? 2 : 1] = ctx.main_fn; + } + + si_build_wrapper_function(&ctx, parts, 1 + need_prolog + need_epilog, + need_prolog ? 1 : 0); + } else if (is_monolithic && ctx.type == PIPE_SHADER_FRAGMENT) { LLVMValueRef parts[3]; union si_shader_part_key prolog_key; union si_shader_part_key epilog_key; |