summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2017-02-21 20:32:51 +0100
committerMarek Olšák <marek.olsak@amd.com>2017-04-17 01:22:11 +0200
commitbd2cde0c259d925d9c3f3ae704cf0aac460863b9 (patch)
tree118ca438ca499bcf5ed2cdf46a3f5dc9520a0c00 /src
parent777f305840271a2f7ddf08a15ea8ad24f0bc04fc (diff)
radeonsi: add si_shader_selector::vs_needs_prolog
cleanup Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c12
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c4
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 00264b5796..b49e801101 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 f145eab14f..cfa691b058 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 9d05871b8e..21185c37fa 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;