summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-28 21:31:27 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-11-02 12:36:29 +0100
commita11ff430d08d36efa548a8ca0fad0e7eeec7115d (patch)
tree321c1138e2d38d63f115272a4dec16b990cf91f6
parent47a43e5e99025ca43c6ebd54e8f8c2a5961cece6 (diff)
radeonsi: use VS prolog and epilog for monolithic shaders
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c35
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 226c33506e..7272313554 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;