summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-04-20 01:10:17 +0200
committerMarek Olšák <[email protected]>2017-04-28 21:47:35 +0200
commitc73d9bd64388bb77194085e882702011fb6e17f8 (patch)
tree040a878b58115b85c106fb2228890f1b2c0dc175 /src/gallium/drivers/radeonsi
parenta98c9ba5809bdd5a31e30caab41984d127966d51 (diff)
radeonsi: separate out code for selecting the VS prolog
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 9640d8a187e..8b467ea342d 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -7870,6 +7870,32 @@ static void si_build_vs_epilog_function(struct si_shader_context *ctx,
LLVMBuildRetVoid(gallivm->builder);
}
+static bool si_get_vs_prolog(struct si_screen *sscreen,
+ LLVMTargetMachineRef tm,
+ struct si_shader *shader,
+ struct pipe_debug_callback *debug,
+ struct si_shader *main_part,
+ const struct si_vs_prolog_bits *key)
+{
+ struct si_shader_selector *vs = main_part->selector;
+
+ /* The prolog is a no-op if there are no inputs. */
+ if (!vs->vs_needs_prolog)
+ return true;
+
+ /* Get the prolog. */
+ union si_shader_part_key prolog_key;
+ si_get_vs_prolog_key(&vs->info, main_part->info.num_input_sgprs,
+ key, shader, &prolog_key);
+
+ shader->prolog =
+ si_get_shader_part(sscreen, &sscreen->vs_prologs,
+ PIPE_SHADER_VERTEX, true, &prolog_key, tm,
+ debug, si_build_vs_prolog_function,
+ "Vertex Shader Prolog");
+ return shader->prolog != NULL;
+}
+
/**
* Create & compile a vertex shader epilog. This a helper used by VS and TES.
*/
@@ -7899,23 +7925,9 @@ static bool si_shader_select_vs_parts(struct si_screen *sscreen,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
- if (shader->selector->vs_needs_prolog) {
- union si_shader_part_key prolog_key;
-
- /* Get the prolog. */
- si_get_vs_prolog_key(&shader->selector->info,
- shader->info.num_input_sgprs,
- &shader->key.part.vs.prolog,
- shader, &prolog_key);
- shader->prolog =
- si_get_shader_part(sscreen, &sscreen->vs_prologs,
- PIPE_SHADER_VERTEX, true,
- &prolog_key, tm, debug,
- si_build_vs_prolog_function,
- "Vertex Shader Prolog");
- if (!shader->prolog)
- return false;
- }
+ if (!si_get_vs_prolog(sscreen, tm, shader, debug, shader,
+ &shader->key.part.vs.prolog))
+ return false;
/* Get the epilog. */
if (!shader->key.as_es && !shader->key.as_ls &&