[Mesa-dev] [PATCH 1/3] Don't compute as_ls/as_es before hashing.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Oct 24 22:17:51 UTC 2017


---
 src/amd/vulkan/radv_pipeline.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 669d9a4858e..1d7ebfb85e8 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1141,7 +1141,7 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline *pipeline,
 }
 
 static struct ac_shader_variant_key
-radv_compute_vs_key(const VkGraphicsPipelineCreateInfo *pCreateInfo, bool as_es, bool as_ls)
+radv_compute_vs_key(const VkGraphicsPipelineCreateInfo *pCreateInfo)
 {
 	struct ac_shader_variant_key key;
 	const VkPipelineVertexInputStateCreateInfo *input_state =
@@ -1149,8 +1149,6 @@ radv_compute_vs_key(const VkGraphicsPipelineCreateInfo *pCreateInfo, bool as_es,
 
 	memset(&key, 0, sizeof(key));
 	key.vs.instance_rate_inputs = 0;
-	key.vs.as_es = as_es;
-	key.vs.as_ls = as_ls;
 
 	for (unsigned i = 0; i < input_state->vertexAttributeDescriptionCount; ++i) {
 		unsigned binding;
@@ -1779,6 +1777,15 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
 
 	radv_link_shaders(pipeline, nir);
 
+	if (keys && nir[MESA_SHADER_TESS_CTRL])
+		keys[MESA_SHADER_VERTEX].vs.as_ls = true;
+	if (keys && nir[MESA_SHADER_GEOMETRY]) {
+		if (nir[MESA_SHADER_TESS_CTRL])
+			keys[MESA_SHADER_TESS_EVAL].tes.as_es = true;
+		else
+			keys[MESA_SHADER_VERTEX].vs.as_es = true;
+	}
+
 	if (nir[MESA_SHADER_FRAGMENT]) {
 		if (!pipeline->shaders[MESA_SHADER_FRAGMENT]) {
 			pipeline->shaders[MESA_SHADER_FRAGMENT] =
@@ -1905,28 +1912,19 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
 	memset(keys, 0, sizeof(keys));
 
 	if (pStages[MESA_SHADER_VERTEX]) {
-		bool as_es = false;
-		bool as_ls = false;
-		if (pStages[MESA_SHADER_TESS_CTRL])
-			as_ls = true;
-		else if (pStages[MESA_SHADER_GEOMETRY])
-			as_es = true;
-
-		keys[MESA_SHADER_VERTEX] = radv_compute_vs_key(pCreateInfo, as_es, as_ls);
+		keys[MESA_SHADER_VERTEX] = radv_compute_vs_key(pCreateInfo);
 		keys[MESA_SHADER_VERTEX].has_multiview_view_index = has_view_index;
 	}
 
 	if (pStages[MESA_SHADER_TESS_EVAL]) {
 		keys[MESA_SHADER_TESS_EVAL].has_multiview_view_index = has_view_index;
-		if (pStages[MESA_SHADER_GEOMETRY])
-			keys[MESA_SHADER_TESS_EVAL].tes.as_es = true;
 	}
 
 	if (pCreateInfo->pTessellationState)
 		keys[MESA_SHADER_TESS_CTRL].tcs.input_vertices = pCreateInfo->pTessellationState->patchControlPoints;
 
 	if (pStages[MESA_SHADER_GEOMETRY]) {
-		keys[MESA_SHADER_GEOMETRY] = radv_compute_vs_key(pCreateInfo, false, false);
+		keys[MESA_SHADER_GEOMETRY] = radv_compute_vs_key(pCreateInfo);
 		keys[MESA_SHADER_GEOMETRY].has_multiview_view_index = has_view_index;
 	}
 
-- 
2.14.2



More information about the mesa-dev mailing list