[Mesa-dev] [PATCH 13/61] radeonsi: adjust the signature of si_get_vs_prolog_key

Marek Olšák maraeo at gmail.com
Mon Apr 24 08:45:10 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_shader.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 00aabc9..f6cd313 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -7060,35 +7060,41 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
 		return false;
 	}
 
 	si_llvm_build_ret(ctx, ctx->return_value);
 	return true;
 }
 
 /**
  * Compute the VS prolog key, which contains all the information needed to
  * build the VS prolog function, and set shader->info bits where needed.
+ *
+ * \param shader_in	Vertex shader
+ * \param prolog_key	Key of the VS prolog
+ * \param shader_out	Same as shader_in, or the next shader if merging LS+HS or ES+GS.
+ * \param key		Output shader part key.
  */
-static void si_get_vs_prolog_key(struct si_shader *shader,
+static void si_get_vs_prolog_key(const struct tgsi_shader_info *info,
+				 unsigned num_input_sgprs,
+				 const struct si_vs_prolog_bits *prolog_key,
+				 struct si_shader *shader_out,
 				 union si_shader_part_key *key)
 {
-	struct tgsi_shader_info *info = &shader->selector->info;
-
 	memset(key, 0, sizeof(*key));
-	key->vs_prolog.states = shader->key.part.vs.prolog;
-	key->vs_prolog.num_input_sgprs = shader->info.num_input_sgprs;
+	key->vs_prolog.states = *prolog_key;
+	key->vs_prolog.num_input_sgprs = num_input_sgprs;
 	key->vs_prolog.last_input = MAX2(1, info->num_inputs) - 1;
 
 	/* Set the instanceID flag. */
 	for (unsigned i = 0; i < info->num_inputs; i++)
 		if (key->vs_prolog.states.instance_divisors[i])
-			shader->info.uses_instanceid = true;
+			shader_out->info.uses_instanceid = true;
 }
 
 /**
  * Compute the VS epilog key, which contains all the information needed to
  * build the VS epilog function, and set the PrimitiveID output offset.
  */
 static void si_get_vs_epilog_key(struct si_shader *shader,
 				 struct si_vs_epilog_bits *states,
 				 union si_shader_part_key *key)
 {
@@ -7561,21 +7567,24 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
 		bool need_prolog;
 		bool need_epilog;
 
 		need_prolog = sel->vs_needs_prolog;
 		need_epilog = !shader->key.as_es && !shader->key.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_get_vs_prolog_key(&sel->info,
+					     shader->info.num_input_sgprs,
+					     &shader->key.part.vs.prolog,
+					     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.part.vs.epilog, &epilog_key);
 			si_build_vs_epilog_function(&ctx, &epilog_key);
 			parts[need_prolog ? 2 : 1] = ctx.main_fn;
 		}
@@ -8010,22 +8019,24 @@ static bool si_get_vs_epilog(struct si_screen *sscreen,
  */
 static bool si_shader_select_vs_parts(struct si_screen *sscreen,
 				      LLVMTargetMachineRef tm,
 				      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, &prolog_key);
-
+		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;
 	}
 
-- 
2.7.4



More information about the mesa-dev mailing list