[Mesa-dev] [PATCH 07/16] radeonsi: Take GS into account for VS state in more places

Michel Dänzer michel at daenzer.net
Fri Jan 24 01:33:19 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     | 4 ++++
 src/gallium/drivers/radeonsi/si_shader.h     | 8 ++++++++
 src/gallium/drivers/radeonsi/si_state_draw.c | 4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 35a646b..f942e5c 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2360,6 +2360,7 @@ static int si_generate_gs_copy_shader(struct si_context *sctx,
 	struct lp_build_tgsi_context *bld_base = &si_shader_ctx->radeon_bld.soa.bld_base;
 	struct lp_build_context *base = &bld_base->base;
 	struct lp_build_context *uint = &bld_base->uint_bld;
+	struct si_shader *shader = &si_shader_ctx->shader->shader;
 	struct si_shader *gs = &si_shader_ctx->shader->selector->current->shader;
 	struct si_shader_output_values *outputs;
 	LLVMValueRef t_list_ptr, t_list;
@@ -2400,6 +2401,8 @@ static int si_generate_gs_copy_shader(struct si_context *sctx,
 		struct si_shader_output *out = gs->output + i;
 		unsigned chan;
 
+		shader->output[i] = *out;
+
 		outputs[i].name = out->name;
 		outputs[i].index = out->index;
 		outputs[i].usage = out->usage;
@@ -2419,6 +2422,7 @@ static int si_generate_gs_copy_shader(struct si_context *sctx,
 						 base->elem_type, "");
 		}
 	}
+	shader->noutput = gs->noutput;
 
 	si_llvm_export_vs(bld_base, outputs, gs->noutput);
 
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index d11d346..63c19ec 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -183,6 +183,14 @@ struct si_pipe_shader {
 	union si_shader_key		key;
 };
 
+static inline struct si_shader* si_get_vs_state(struct si_context *sctx)
+{
+	if (sctx->gs_shader)
+		return &sctx->gs_shader->current->gs_copy_shader->shader;
+	else
+		return &sctx->vs_shader->current->shader;
+}
+
 /* radeonsi_shader.c */
 int si_pipe_shader_create(struct pipe_context *ctx, struct si_pipe_shader *shader);
 int si_pipe_shader_create(struct pipe_context *ctx, struct si_pipe_shader *shader);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index f326261..6f485e5 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -408,7 +408,7 @@ static bool si_update_draw_info_state(struct si_context *sctx,
 				      const struct pipe_index_buffer *ib)
 {
 	struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
-	struct si_shader *vs = &sctx->vs_shader->current->shader;
+	struct si_shader *vs = si_get_vs_state(sctx);
 	unsigned prim = si_conv_pipe_prim(info->mode);
 	unsigned ls_mask = 0;
 
@@ -490,7 +490,7 @@ static bool si_update_draw_info_state(struct si_context *sctx,
 static void si_update_spi_map(struct si_context *sctx)
 {
 	struct si_shader *ps = &sctx->ps_shader->current->shader;
-	struct si_shader *vs = &sctx->vs_shader->current->shader;
+	struct si_shader *vs = si_get_vs_state(sctx);
 	struct si_pm4_state *pm4 = si_pm4_alloc_state(sctx);
 	unsigned i, j, tmp;
 
-- 
1.8.5.3



More information about the mesa-dev mailing list