summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2014-01-09 16:10:49 +0900
committerMichel Dänzer <[email protected]>2014-01-29 11:07:35 +0900
commit8afde9fa23db6ac1802f7a2c74123f10db96f552 (patch)
treefcdc2b0435bb9d28fd030acd533cf19e40bf1690 /src
parent28630713b2773a362f06be91818593e310215288 (diff)
radeonsi: Take GS into account for VS state in more places
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h8
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c4
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 6788255f62b..227d6829926 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2330,6 +2330,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;
@@ -2370,6 +2371,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;
@@ -2389,6 +2392,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 d11d34646ac..63c19ecaeef 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 41d2e1c24ac..e4045cd85a6 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -403,7 +403,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 gs_out_prim =
si_conv_prim_to_gs_out(sctx->gs_shader ?
@@ -488,7 +488,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;