[Mesa-dev] [PATCH 08/16] radeonsi: Also export clip distances with geometry shader

Michel Dänzer michel at daenzer.net
Fri Jan 24 01:33:20 PST 2014


From: Michel Dänzer <michel.daenzer at amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/gallium/drivers/radeonsi/si_shader.c |  1 +
 src/gallium/drivers/radeonsi/si_state.c  | 13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index f942e5c..100a385 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2584,6 +2584,7 @@ int si_pipe_shader_create(
 	if (si_shader_ctx.type == TGSI_PROCESSOR_GEOMETRY) {
 		shader->gs_copy_shader = CALLOC_STRUCT(si_pipe_shader);
 		shader->gs_copy_shader->selector = shader->selector;
+		shader->gs_copy_shader->key = shader->key;
 		si_shader_ctx.shader = shader->gs_copy_shader;
 		if ((r = si_generate_gs_copy_shader(sctx, &si_shader_ctx, dump))) {
 			free(shader->gs_copy_shader);
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 10a7ed9..23667e7 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2144,6 +2144,14 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
 	struct si_context *sctx = (struct si_context *)ctx;
 	memset(key, 0, sizeof(*key));
 
+	if ((sel->type == PIPE_SHADER_VERTEX || sel->type == PIPE_SHADER_GEOMETRY) &&
+	    sctx->queued.named.rasterizer) {
+		if (sctx->queued.named.rasterizer->clip_plane_enable & 0xf0)
+			key->vs.ucps_enabled |= 0x2;
+		if (sctx->queued.named.rasterizer->clip_plane_enable & 0xf)
+			key->vs.ucps_enabled |= 0x1;
+	}
+
 	if (sel->type == PIPE_SHADER_VERTEX) {
 		unsigned i;
 		if (!sctx->vertex_elements)
@@ -2152,11 +2160,6 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
 		for (i = 0; i < sctx->vertex_elements->count; ++i)
 			key->vs.instance_divisors[i] = sctx->vertex_elements->elements[i].instance_divisor;
 
-		if (sctx->queued.named.rasterizer->clip_plane_enable & 0xf0)
-			key->vs.ucps_enabled |= 0x2;
-		if (sctx->queued.named.rasterizer->clip_plane_enable & 0xf)
-			key->vs.ucps_enabled |= 0x1;
-
 		key->vs.as_es = sctx->gs_shader != NULL;
 	} else if (sel->type == PIPE_SHADER_FRAGMENT) {
 		if (sel->fs_write_all)
-- 
1.8.5.3



More information about the mesa-dev mailing list