[Mesa-dev] [PATCH 04/15] radv: gather the number of streams used by geometry shaders

Samuel Pitoiset samuel.pitoiset at gmail.com
Sat Oct 13 12:57:28 UTC 2018


This will be used for splitting the GS->VS ring buffer. The
stream ID is always 0 for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_shader.h      |  1 +
 src/amd/vulkan/radv_shader_info.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index c490b69f52..f02ca1cf8d 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -159,6 +159,7 @@ struct radv_shader_info {
 	} vs;
 	struct {
 		uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
+		uint8_t max_stream;
 	} gs;
 	struct {
 		uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
index 6262acb1a6..00bc2ca5db 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -434,6 +434,17 @@ gather_info_output_decl_ps(const nir_shader *nir, const nir_variable *var,
 	}
 }
 
+static void
+gather_info_output_decl_gs(const nir_shader *nir, const nir_variable *var,
+			   struct radv_shader_info *info)
+{
+	unsigned stream = var->data.stream;
+
+	assert(stream < 4);
+
+	info->gs.max_stream = MAX2(info->gs.max_stream, stream);
+}
+
 static void
 gather_info_output_decl(const nir_shader *nir, const nir_variable *var,
 			struct radv_shader_info *info,
@@ -447,6 +458,9 @@ gather_info_output_decl(const nir_shader *nir, const nir_variable *var,
 		if (options->key.vs.as_ls)
 			gather_info_output_decl_ls(nir, var, info);
 		break;
+	case MESA_SHADER_GEOMETRY:
+		gather_info_output_decl_gs(nir, var, info);
+		break;
 	default:
 		break;
 	}
-- 
2.19.1



More information about the mesa-dev mailing list