From bd2cde0c259d925d9c3f3ae704cf0aac460863b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 21 Feb 2017 20:32:51 +0100 Subject: [PATCH] radeonsi: add si_shader_selector::vs_needs_prolog MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit cleanup Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c | 12 +++++------- src/gallium/drivers/radeonsi/si_shader.h | 1 + src/gallium/drivers/radeonsi/si_state_shaders.c | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 00264b57963..b49e801101c 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -7539,7 +7539,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen, bool need_prolog; bool need_epilog; - need_prolog = sel->info.num_inputs; + need_prolog = sel->vs_needs_prolog; need_epilog = !shader->key.as_es && !shader->key.as_ls; parts[need_prolog ? 1 : 0] = ctx.main_fn; @@ -7992,14 +7992,12 @@ static bool si_shader_select_vs_parts(struct si_screen *sscreen, struct si_shader *shader, struct pipe_debug_callback *debug) { - struct tgsi_shader_info *info = &shader->selector->info; - union si_shader_part_key prolog_key; + if (shader->selector->vs_needs_prolog) { + union si_shader_part_key prolog_key; - /* Get the prolog. */ - si_get_vs_prolog_key(shader, &prolog_key); + /* Get the prolog. */ + si_get_vs_prolog_key(shader, &prolog_key); - /* The prolog is a no-op if there are no inputs. */ - if (info->num_inputs) { shader->prolog = si_get_shader_part(sscreen, &sscreen->vs_prologs, PIPE_SHADER_VERTEX, true, diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index f145eab14f3..cfa691b0589 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -298,6 +298,7 @@ struct si_shader_selector { /* PIPE_SHADER_[VERTEX|FRAGMENT|...] */ unsigned type; + bool vs_needs_prolog; /* GS parameters. */ unsigned esgs_itemsize; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 9d05871b8e2..21185c37fa8 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1610,6 +1610,10 @@ static void *si_create_shader_selector(struct pipe_context *ctx, sel->type = sel->info.processor; p_atomic_inc(&sscreen->b.num_shaders_created); + /* The prolog is a no-op if there are no inputs. */ + sel->vs_needs_prolog = sel->type == PIPE_SHADER_VERTEX && + sel->info.num_inputs; + /* Set which opcode uses which (i,j) pair. */ if (sel->info.uses_persp_opcode_interp_centroid) sel->info.uses_persp_centroid = true; -- 2.30.2